The .Net MSBuild Google Closure Compiler is used to compress your JavaScript files using Google's Closure Compiler Api. Easily compress your JavaScript files using this MSBuild task by adding some entries to your Visual Studio project files as seen below:

<Import Project="path to ClosureCompiler.tasks" />

<Target Name="AfterBuild">
<ItemGroup>
<JS Include="\.js" Exclude="\.min.js" />
</ItemGroup>
<ClosureCompiler ApiUrl="http://closure-compiler.appspot.com/compile" CompilationLevel="SIMPLE_OPTIMIZATIONS" SourceFiles="@(JS)" SourceExtensionPattern="\.js$" TargetExtension=".min.js" />
</Target>

ApiUrl (optional) = url to the closure compiler api; if the attribute is omitted then the url listed above is automatically used
CompilationLevel (optional) = the level of compilation; currently the compiler supports three levels. if the attribute is omitted WHITESPACEONLY is used by default. attributes available are: WHITESPACEONLY, SIMPLEOPTIMIZATIONS, ADVANCEDOPTIMIZATIONS

Full compiler api reference is available at http://code.google.com/closure/compiler/docs/api-ref.html

Last edited Feb 20, 2010 at 8:39 PM by jfuehner, version 1

Comments

No comments yet.