|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor
@Minimize @SupportedResourceType(value=JS) public class GoogleClosureCompressorProcessor
Uses Google closure compiler for js minimization.
In order to make this classContext agnostic, set the encoding explicitly using
setEncoding(String).
http://blog.bolinfest.com/2009/11/calling-closure-compiler-from-java.html| Field Summary | |
|---|---|
static String |
ALIAS_ADVANCED
|
static String |
ALIAS_SIMPLE
|
static String |
ALIAS_WHITESPACE_ONLY
|
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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)
Perform actual resource processing. |
void |
process(Resource resource,
Reader reader,
Writer writer)
Process a content supplied by a reader and perform some sort of processing. |
GoogleClosureCompressorProcessor |
setCompilationLevel(com.google.javascript.jscomp.CompilationLevel compilationLevel)
|
GoogleClosureCompressorProcessor |
setCompilerOptions(com.google.javascript.jscomp.CompilerOptions compilerOptions)
|
GoogleClosureCompressorProcessor |
setEncoding(String encoding)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ALIAS_SIMPLE
public static final String ALIAS_ADVANCED
public static final String ALIAS_WHITESPACE_ONLY
| Constructor Detail |
|---|
public GoogleClosureCompressorProcessor()
CompilationLevel.SIMPLE_OPTIMIZATIONS
public GoogleClosureCompressorProcessor(com.google.javascript.jscomp.CompilationLevel compilationLevel)
compilationLevel - not null CompilationLevel enum.| Method Detail |
|---|
public void process(Resource resource,
Reader reader,
Writer writer)
throws IOException
Resource, because
this way you can ignore the other preProcessors from the chain.RuntimeException and the processing chain is interrupted (by default)WroConfiguration.isIgnoreFailingProcessor() is true)
process in interface ResourcePreProcessorresource - the original resource as it found in the model.reader - Reader used to read processed resource content.writer - Writer where used to write processed results.
IOException - when an exception occurs. The future version will change the exception type to Exception, because
any exception may occur during processing. The processing failure will be handled based on value of
WroConfiguration.isIgnoreFailingProcessor() configuration flag.protected 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 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 ResourcePostProcessorreader - source stream.writer - destination stream.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||