Skip to content

Instantly share code, notes, and snippets.

@zhangw
Created December 27, 2012 09:14
Show Gist options
  • Save zhangw/4386812 to your computer and use it in GitHub Desktop.
Save zhangw/4386812 to your computer and use it in GitHub Desktop.
use google-closure to compress js files with powershell in batches.
$filepath="C:\SourceCode\FCSLN\FCProperty\FCProperty\Content"
$compile="C:\Temp\google-closure\compiler.jar"
$jsfiles = ls $filepath -Recurse -Include *.js -Exclude *.min.js
Foreach($js in $jsfiles){$i=$js.FullName.LastIndexOf(".js")
$compressjs= $js.FullName.Remove($i)+".min.js"
java -jar $compile --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file $compressjs $js.FullName
}
ls $filepath -Recurse -Include *.min.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment