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">
<JS Include="\.js" Exclude="\.min.js" />
<ClosureCompiler ApiUrl="" CompilationLevel="SIMPLE_OPTIMIZATIONS" SourceFiles="@(JS)" SourceExtensionPattern="\.js$" TargetExtension=".min.js" />

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

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


No comments yet.