Bundle Transformer: Closure
BundleTransformer.Closure contains 2 minifier-adapters for minification of JS-code:
ClosureLocalJsMinifier. ClosureRemoteJsMinifier is based on the
Google Closure Compiler Service API and requires a permanent connection to Internet.
ClosureLocalJsMinifier is based on the
Google Closure Compiler Application and for their work requires latest version of file
To make ClosureRemoteJsMinifier or
ClosureLocalJsMinifier is the default JS-minifier, you need to make changes to the
Web.config file. In the
defaultMinifier attribute of the \configuration\bundleTransformer\core\js element must be set value equal to
To start using ClosureLocalJsMinifier need to make the following preliminary work:
- On your computer must be installed Java 6 or higher. Latest version of Java can be downloaded at the following URL -
- You need to download latest version of the Google Closure Compiler Application, which is located on the URL -
- Unzip the downloaded archive and copy the file
compiler.jar in some directory on disk of your computer.
- In Web.config file find the
configuration/bundleTransformer/closure/local element, then set the
javaVirtualMachinePath attribute to a value equal to the path to executable file of the Java Virtual Machine (java.exe), and set the
closureCompilerApplicationPath attribute to a value equal to the path to JAR-file of the Google Closure Compiler Application (compiler.jar).
Often during the advanced compilation, you need to use the externs files (see
«Advanced Compilation and Externs» and
«How do I write an externs file?»). You can specify the externs files in the
Web.config file (in the Visual Studio supported IntelliSense):
In the \bundleTransformer\closure\js\commonExternsFiles element you can specify the paths to externs files, that will be applied to all script assets. The
\bundleTransformer\closure\js\externsFileMappings element is used for binding externs files to script assets. In the mapping you can bind multiple externs files (separated by commas) to the script.