Skip to content

Instantly share code, notes, and snippets.

@insin
Created December 22, 2011 01:06
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save insin/1508450 to your computer and use it in GitHub Desktop.
Save insin/1508450 to your computer and use it in GitHub Desktop.
Google Closure Compiler build for Sublime Text 2
This build uses Google's Closure Compiler solely for its error output, allowing
you to use Ctrl+B for a quick syntax sanity check while editing JavaScript files,
using F4/Shift+F4 to cycle through any syntax errors the compiler flags up.
To add the build:
1. Create a new file in Packages/Google Closure/Google Closure.sublime-build
with contents as per this Gist, depending on your OS.
2. Download the Closure compiler.jar from http://code.google.com/closure/compiler/
and place it in Packages/Google Closure.
{
"cmd": ["java", "-jar", "${packages}/Google Closure/compiler.jar", "--js", "$file", "--js_output_file", "/dev/null", "--compilation_level", "WHITESPACE_ONLY"],
"file_regex": "^(.*):([0-9]+):() ERROR - (.*)",
"selector": "source.js"
}
{
"cmd": ["java", "-jar", "${packages}/Google Closure/compiler.jar", "--js", "$file", "--js_output_file", "NUL", "--compilation_level", "WHITESPACE_ONLY"],
"file_regex": "^(.*):([0-9]+):() ERROR - (.*)",
"selector": "source.js"
}
@eruizdechavez
Copy link

To Windows users:

Replace "/dev/null" with "NUL"

@bytesandwich
Copy link

I've been looking for a little while to see if I can get the errors inlined. It seems to me the best option is https://github.com/SublimeLinter/SublimeLinter#creating-new-linters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment