Class GoogleClosureJavascriptMinificationServiceImpl
java.lang.Object
org.broadleafcommerce.common.resource.service.GoogleClosureJavascriptMinificationServiceImpl
- All Implemented Interfaces:
JavascriptMinificationService
@Service("blJavascriptMinificationService")
public class GoogleClosureJavascriptMinificationServiceImpl
extends Object
implements JavascriptMinificationService
Javascript minification service implemented using the Google Closure Compiler
This will be used for minification if the Google Closure Compiler dependency is included in the project
This library also supports extra aggressive minification, transpiling, code optimizing, and bundleing
- minify.closure.compiler.languageIn - Sets ECMAScript version to use for the input.
Options: ECMASCRIPT3, ECMASCRIPT5, ECMASCRIPT5_STRICT, ECMASCRIPT6_TYPED (experimental), ECMASCRIPT_2015, ECMASCRIPT_2016, ECMASCRIPT_2017, ECMASCRIPT_NEXT
Default: ECMASCRIPT5 - minify.closure.compiler.languageOut - Sets ECMAScript version to use for the output.
Options: ECMASCRIPT3, ECMASCRIPT5, ECMASCRIPT5_STRICT, ECMASCRIPT6_TYPED (experimental), ECMASCRIPT_2015, ECMASCRIPT_2016, ECMASCRIPT_2017, ECMASCRIPT_NEXT, NO_TRANSPILE
Default: NO_TRANSPILE - minify.closure.compiler.warningLevel - Warnings level. Possible values: QUIET, DEFAULT, VERBOSE
Default: SILENT
- Author:
- Jay Aisenbrey (cja769)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGoogleClosureJavascriptMinificationServiceImpl
(String compilerLanguageIn, String compilerLanguageOut) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
protected com.google.javascript.jscomp.Compiler
protected com.google.javascript.jscomp.CompilerOptions
void
Minifies the file in "reader" and writes the minified version to "writer"
-
Field Details
-
warningLevel
-
strictMode
-
languageIn
protected com.google.javascript.jscomp.CompilerOptions.LanguageMode languageIn -
languageOut
protected com.google.javascript.jscomp.CompilerOptions.LanguageMode languageOut
-
-
Constructor Details
-
GoogleClosureJavascriptMinificationServiceImpl
-
-
Method Details
-
minifyJs
public void minifyJs(String filename, Reader reader, Writer writer) throws ResourceMinificationException Description copied from interface:JavascriptMinificationService
Minifies the file in "reader" and writes the minified version to "writer"- Specified by:
minifyJs
in interfaceJavascriptMinificationService
- Parameters:
filename
- Name of the file to be minifiedreader
- The original filewriter
- The writer that the minified version of the file in "reader" will be written to- Throws:
ResourceMinificationException
- Failure to successfully minify the bytes in "reader"
-
compileJs
protected String compileJs(com.google.javascript.jscomp.SourceFile input, String filename) throws ResourceMinificationException, IOException -
getCompiler
protected com.google.javascript.jscomp.Compiler getCompiler() -
getCompilerOptions
protected com.google.javascript.jscomp.CompilerOptions getCompilerOptions()
-