Skip to content

Instantly share code, notes, and snippets.

@mrmartineau
Last active December 15, 2015 11:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmartineau/5253200 to your computer and use it in GitHub Desktop.
Save mrmartineau/5253200 to your computer and use it in GitHub Desktop.
Sublime Closure Compile Build Script. Use a batchfile or shell script to determine which files should be concatinated and minified, then reference that in your Sublime build script
/** //@ sourceMappingURL=app.min.js.map
*/
console.log('foo');console.log('bar');
@echo Batch
@echo Compile JS
cd js/compiled
java -jar path/to/compiler.jar ^
--compilation_level SIMPLE_OPTIMIZATIONS ^
--js relative/path/to/file1.js ^
--js relative/path/to/file2.js ^
--create_source_map app.min.js.map ^
--source_map_format=V3 ^
--js_output_file app.min.js
@echo Done compiling
#!/bin/bash
echo "Compile JS"
cd js/compiled
java -jar path/to/compiler.jar \
--compilation_level SIMPLE_OPTIMIZATIONS \
--js relative/path/to/file1.js \
--js relative/path/to/file2.js \
--create_source_map app.min.js.map \
--source_map_format=V3 \
--js_output_file app.min.js
echo "Done compiling"
{
"selector": "source.js",
"cmd": ["./JS-build.sh"],
// Assuming your Sublime Project file is saved within your project dir
// Change the working dir to shell/batch scripts
"working_dir": "${project_path}",
"file_regex": "^(.*):([0-9]+):() ERROR - (.*)",
"windows":
{
"cmd": ["JS-build.bat"]
}
}
/** @preserve //@ sourceMappingURL=_app.min.js.map
*/
console.log('foo');
console.log('bar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment