-
Notifications
You must be signed in to change notification settings - Fork 19
Closure
BundleTransformer.Closure contains two 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 compiler.jar
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 ClosureRemoteJsMinifier
or ClosureLocalJsMinifier
.
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 - https://www.java.com/download/.
- You need to download latest version of the Google Closure Compiler Application, which is located on the URL - https://mvnrepository.com/artifact/com.google.javascript/closure-compiler.
- 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 thejavaVirtualMachinePath
attribute to a value equal to the path to executable file of the Java Virtual Machine (java.exe
), and set theclosureCompilerApplicationPath
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 “Externs and Exports” 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 /configuration/bundleTransformer/closure/js/commonExternsFiles
element you can specify the paths to externs files, that will be applied to all script assets.
The /configuration/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.