ro.isdc.wro.extensions.processor.js
Class GoogleClosureCompressorProcessor
java.lang.Object
ro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor
- All Implemented Interfaces:
- ResourcePostProcessor, ResourcePreProcessor
@Minimize
@SupportedResourceType(value=JS)
public class GoogleClosureCompressorProcessor
- extends Object
- implements ResourcePostProcessor, ResourcePreProcessor
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
- See Also:
http://blog.bolinfest.com/2009/11/calling-closure-compiler-from-java.html
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALIAS_SIMPLE
public static final String ALIAS_SIMPLE
- See Also:
- Constant Field Values
ALIAS_ADVANCED
public static final String ALIAS_ADVANCED
- See Also:
- Constant Field Values
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 null CompilationLevel enum.
process
public void process(Resource resource,
Reader reader,
Writer writer)
throws IOException
-
- Specified by:
process in interface ResourcePreProcessor
- Throws:
IOException
setEncoding
public GoogleClosureCompressorProcessor setEncoding(String encoding)
- Parameters:
encoding - the encoding to set
getExterns
protected com.google.javascript.jscomp.JSSourceFile[] getExterns(Resource resource)
- 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.
setCompilerOptions
public GoogleClosureCompressorProcessor setCompilerOptions(com.google.javascript.jscomp.CompilerOptions compilerOptions)
- Parameters:
compilerOptions - the compilerOptions to set
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
CompilerOptions object to be used by compressor.
process
public void process(Reader reader,
Writer writer)
throws IOException
-
- Specified by:
process in interface ResourcePostProcessor
- Throws:
IOException
Copyright © 2008-2012. All Rights Reserved.