@Minimize @SupportedResourceType(value=JS) public class GoogleClosureCompressorProcessor extends Object implements ResourcePostProcessor, ResourcePreProcessor
Context agnostic, set the encoding explicitly using
setEncoding(String).http://blog.bolinfest.com/2009/11/calling-closure-compiler-from-java.html| Modifier and Type | Field and Description |
|---|---|
static String |
ALIAS_ADVANCED |
static String |
ALIAS_SIMPLE |
static String |
ALIAS_WHITESPACE_ONLY |
| 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 |
|---|---|
protected com.google.javascript.jscomp.JSSourceFile[] |
getExterns(Resource resource) |
protected com.google.javascript.jscomp.CompilerOptions |
newCompilerOptions() |
void |
process(Reader reader,
Writer writer) |
void |
process(Resource resource,
Reader reader,
Writer writer) |
GoogleClosureCompressorProcessor |
setCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel) |
GoogleClosureCompressorProcessor |
setCompilerOptions(com.google.javascript.jscomp.CompilerOptions compilerOptions) |
GoogleClosureCompressorProcessor |
setEncoding(String encoding) |
public static final String ALIAS_SIMPLE
public static final String ALIAS_ADVANCED
public static final String ALIAS_WHITESPACE_ONLY
public GoogleClosureCompressorProcessor()
CompilationLevel.SIMPLE_OPTIMIZATIONSpublic GoogleClosureCompressorProcessor(com.google.javascript.jscomp.CompilationLevel compilationLevel)
compilationLevel - not null CompilationLevel enum.public void process(Resource resource, Reader reader, Writer writer) throws IOException
process in interface ResourcePreProcessorIOExceptionpublic GoogleClosureCompressorProcessor setEncoding(String encoding)
encoding - the encoding to setprotected com.google.javascript.jscomp.JSSourceFile[] getExterns(Resource resource)
resource - Currently processed resource. The resource can be null, when the closure compiler is used as a post
processor.public GoogleClosureCompressorProcessor setCompilerOptions(com.google.javascript.jscomp.CompilerOptions compilerOptions)
compilerOptions - the compilerOptions to setpublic GoogleClosureCompressorProcessor setCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel)
compilationLevel - the compilationLevel to setprotected com.google.javascript.jscomp.CompilerOptions newCompilerOptions()
CompilerOptions object to be used by compressor.public void process(Reader reader, Writer writer) throws IOException
process in interface ResourcePostProcessorIOExceptionCopyright © 2008-2013. All Rights Reserved.