@Minimize @SupportedResourceType(value=JS) public class GoogleClosureCompressorProcessor extends Object implements ResourcePostProcessor, ResourcePreProcessor, Destroyable
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 |
|---|---|
void |
destroy() |
protected com.google.javascript.jscomp.SourceFile[] |
getExterns(Resource resource) |
protected com.google.javascript.jscomp.CompilerOptions |
newCompilerOptions() |
protected void |
onException(Exception e)
Invoked when an exception occurs during processing.
|
void |
process(Reader reader,
Writer writer) |
void |
process(Resource resource,
Reader reader,
Writer writer) |
GoogleClosureCompressorProcessor |
setCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel) |
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 ResourcePreProcessorIOExceptionprotected void onException(Exception e)
WroRuntimeException and throws it further.e - Exception thrown during processing.public GoogleClosureCompressorProcessor setEncoding(String encoding)
encoding - the encoding to setprotected 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.public 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 ResourcePostProcessorIOExceptionpublic void destroy()
throws Exception
destroy in interface DestroyableExceptionCopyright © 2008-2016. All Rights Reserved.