Created
March 20, 2011 22:35
-
-
Save rbackhouse/878746 to your computer and use it in GitHub Desktop.
Example demonstrating calling the Rhino Based Javascript optimizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.dojotoolkit.optimizer.JSAnalysisData; | |
import org.dojotoolkit.optimizer.JSOptimizer; | |
import org.dojotoolkit.optimizer.JSOptimizerFactory; | |
import org.dojotoolkit.optimizer.Localization; | |
import org.dojotoolkit.optimizer.rhino.RhinoJSOptimizerFactory; | |
private void runRhinoOptimizerNoCompressor() { | |
ResourceLoader resourceLoader = new FileBasedResourceLoader(new File("/pathToResources")); | |
RhinoClassLoader rhinoClassLoader = new RhinoClassLoader(resourceLoader); | |
JSOptimizerFactory factory = new RhinoJSOptimizerFactory(); | |
JSOptimizer optimizer = factory.createJSOptimizer(resourceLoader, rhinoClassLoader, true, null); | |
JSAnalysisData analysisData; | |
try { | |
analysisData = optimizer.getAnalysisData(new String[] {"dijit.layout.TabContainer"}); | |
for (String dependency: analysisData.getDependencies()) { | |
System.out.println("["+dependency+"]"); | |
} | |
for (Localization l : analysisData.getLocalizations()) { | |
System.out.println("Localization : "+l.bundlePackage+" | "+l.modulePath+" | "+l.bundleName); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the FileBasedResourceLoader from gist 848002