Class GoogleClosureCompressorProcessor
java.lang.Object
ro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor
- All Implemented Interfaces:
Destroyable,ResourcePostProcessor,ResourcePreProcessor
@Minimize
@SupportedResourceType(JS)
public class GoogleClosureCompressorProcessor
extends Object
implements ResourcePostProcessor, ResourcePreProcessor, Destroyable
Uses Google closure compiler for js minimization.
In order to make this class Context agnostic, set the encoding explicitly using
setEncoding(String).
- Author:
- Alex Objelean
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUses google closure compiler with default compilation level:CompilationLevel.SIMPLE_OPTIMIZATIONSGoogleClosureCompressorProcessor(com.google.javascript.jscomp.CompilationLevel compilationLevel) Uses google closure compiler with specified compilation level. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()protected com.google.javascript.jscomp.SourceFile[]getExterns(Resource resource) protected com.google.javascript.jscomp.CompilerOptionsprotected voidInvoked when an exception occurs during processing.voidvoidsetCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel) setEncoding(String encoding)
-
Field Details
-
ALIAS_SIMPLE
- See Also:
-
ALIAS_ADVANCED
- See Also:
-
ALIAS_WHITESPACE_ONLY
- See Also:
-
-
Constructor Details
-
GoogleClosureCompressorProcessor
public GoogleClosureCompressorProcessor()Uses google closure compiler with default compilation level:CompilationLevel.SIMPLE_OPTIMIZATIONS -
GoogleClosureCompressorProcessor
public GoogleClosureCompressorProcessor(com.google.javascript.jscomp.CompilationLevel compilationLevel) Uses google closure compiler with specified compilation level.- Parameters:
compilationLevel- not nullCompilationLevelenum.
-
-
Method Details
-
process
- Specified by:
processin interfaceResourcePreProcessor- Throws:
IOException
-
onException
Invoked when an exception occurs during processing. Default implementation wraps the exception intoWroRuntimeExceptionand throws it further.- Parameters:
e-Exceptionthrown during processing.
-
setEncoding
- Parameters:
encoding- the encoding to set
-
getExterns
- Parameters:
resource- Currently processed resource. The resource can be null, when the closure compiler is used as a post processor.- Returns:
- An Array of externs files for the resource to process.
-
setCompilationLevel
public GoogleClosureCompressorProcessor setCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel) - Parameters:
compilationLevel- the compilationLevel to set
-
newCompilerOptions
protected com.google.javascript.jscomp.CompilerOptions newCompilerOptions()- Returns:
- default
CompilerOptionsobject to be used by compressor.
-
process
- Specified by:
processin interfaceResourcePostProcessor- Throws:
IOException
-
destroy
- Specified by:
destroyin interfaceDestroyable- Throws:
Exception
-