Last active
October 17, 2018 01:41
-
-
Save HendrikRunte/b3e6226576b9dde1ca23 to your computer and use it in GitHub Desktop.
Sublime Build System for Google Closure Compiler with JS Source Maps
This file contains hidden or 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
{ | |
"cmd": [ | |
"java", | |
"-jar", | |
"${packages}/Google Closure/compiler.jar", | |
"--js", | |
"$file", | |
"--js_output_file", | |
"$file_path/$file_base_name-compiled.js", | |
"--compilation_level", | |
"WHITESPACE_ONLY", | |
"--create_source_map", | |
"$file_base_name-compiled.js.map", | |
"--source_map_location_mapping", | |
"${file_path}|.", | |
"--output_wrapper", | |
"%output%\r\n//# sourceMappingURL=./$file_base_name-compiled.js.map" | |
], | |
"file_regex": "^(.*):([0-9]+):() ERROR - (.*)", | |
"selector": "source.js" | |
} |
Update: Now it uses --output_wrapper and --source_map_location_mapping to notify browsers where to find the source.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to have a simple Build System for Sublime Text 3 which compiles JavaScript and creates a source map, create a new folder insider ~/Library/Application Support/Sublime Text 3/Packages called "Google Closure".
Download the latest Google Closure Compiler from Google: https://developers.google.com/closure/compiler/ unzip and place the file compiler.jar into your shiny new folder (see above).
Create a file named "Google Closure.sublime-build", put it into this folder as well and fill the file with the JSON above.
You can now use Google Closure Compiler to compile your *.js files and create sourceMaps.