public class GoogleClosureCompressorProcessor extends ResourceProcessor
http://blog.bolinfest.com/2009/11/calling-closure-compiler-from-java.html| Modifier and Type | Field and Description |
|---|---|
private com.google.javascript.jscomp.CompilationLevel |
compilationLevel
CompilationLevel to use for compression. |
private ObjectPoolHelper<com.google.javascript.jscomp.CompilerOptions> |
optionsPool
Reuse options(which are not thread safe).
|
| Constructor and Description |
|---|
GoogleClosureCompressorProcessor()
Uses google closure compiler with default compilation level:
CompilationLevel.SIMPLE_OPTIMIZATIONS |
GoogleClosureCompressorProcessor(com.google.javascript.jscomp.CompilationLevel compilationLevel)
Uses google closure compiler with specified compilation level.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
protected com.google.javascript.jscomp.SourceFile[] |
getExterns(Resource resource) |
private com.google.javascript.jscomp.Compiler |
newCompiler(com.google.javascript.jscomp.CompilerOptions compilerOptions) |
protected com.google.javascript.jscomp.CompilerOptions |
newCompilerOptions() |
java.lang.String |
process(Resource resource,
java.lang.String content) |
void |
setCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel) |
private com.google.javascript.jscomp.CompilationLevel compilationLevel
CompilationLevel to use for compression.private ObjectPoolHelper<com.google.javascript.jscomp.CompilerOptions> optionsPool
public GoogleClosureCompressorProcessor()
CompilationLevel.SIMPLE_OPTIMIZATIONSpublic GoogleClosureCompressorProcessor(com.google.javascript.jscomp.CompilationLevel compilationLevel)
compilationLevel - not null CompilationLevel enum.public void setCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel)
compilationLevel - the compilationLevel to setpublic java.lang.String process(Resource resource, java.lang.String content) throws java.io.IOException
process in class ResourceProcessorjava.io.IOExceptionprivate com.google.javascript.jscomp.Compiler newCompiler(com.google.javascript.jscomp.CompilerOptions compilerOptions)
protected com.google.javascript.jscomp.SourceFile[] getExterns(Resource resource)
resource - Currently processed resource. The resource can be null, when the closure compiler is used as a post processor.protected com.google.javascript.jscomp.CompilerOptions newCompilerOptions()
CompilerOptions object to be used by compressor.public void destroy()
throws java.lang.Exception
destroy in class ResourceProcessorjava.lang.Exception