简体   繁体   中英

including Closure Compiler into an asp.net app

I'm using Closure Compiler in my application. For the moment, I use XML to send my javascript to the CC's web service and compile the code. What I want to do is include CC into the project itself so that the compilation doesn't rely on the web service but is done entirely on the server. How do you include the .jar files that are downloaded in the CC download package and make it work in .net?

Thanks.

The simplest solution is just to put the CC folder on that server and then add it's path to your $PATH. Another option is to add it as a resource in the project and then set Copy to Output Dir to Always or If Newer and use a relative path to access it. I believe the second option is better because it removes the outside dependency.

Once you have the file there you can start a command line process with the commands like they have in the docs java -jar compiler.jar --js hello.js --js_output_file hello-compiled.js and it will do what you want. There is of course also a Java dependency. For some basic info on starting process' in C# check out http://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM