This project has moved and is read-only. For the latest updates, please go here.

Bundle Transformer: Closure

BundleTransformer.Closure contains 2 minifier-adapters for minification of JS-code: ClosureRemoteJsMinifier and 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 compiler.jar.

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 ClosureRemoteJsMinifier or ClosureLocalJsMinifier.

To start using ClosureLocalJsMinifier need to make the following preliminary work:

  1. On your computer must be installed Java 6 or higher. Latest version of Java can be downloaded at the following URL -
  2. You need to download latest version of the Google Closure Compiler Application, which is located on the URL -
  3. Unzip the downloaded archive and copy the file compiler.jar in some directory on disk of your computer.
  4. 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):

BundleTransformer.Closure options in the Web.config file

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.

Last edited Mar 28, 2015 at 3:33 PM by Taritsyn, version 3