Skip to content

sub/jsc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsc

jsc, JavaScript Compiler

by Davide Saurino
http://github.com/sub/jsc

Ruby API to Google Closure Compiler Web service.

Features

With jsc you can compile your JavaScript code throught Google Closure Compiler REST service.

The package comes with a jsc command which accepts several options, run:

jsc --help

for help.

More in details:

  • Ruby API actually is a single function call, JSCompiler.compile()

  • Handling of JSON responses, parse and print them (same output of the Google web interface!)

  • Handling of Server Errors responses

  • Compile a file or a piece of code

  • Emacs snippet to compile code your code for errors and warnings

  • flymake compatible

Check Google API Reference for more info about accepted parameters.

Synopsis

Get compiled code, if no errors are found:

jsc js/compiled_code.js

Compile a file, check for errors:

jsc js/errors.js -e

Compile a file, check for warnings:

jsc js/warnings.js -w

Compile a file and get compression stats:

jsc js/compiled_code.js -s

Compile a piece of code, check for errors:

jsc -e -c "function("

Compile a file for both errors and warnings:

jsc js/compiled_code.js -a

Install

If you have gemcutter in your gem sources, run:

[sudo] gem install jsc

Emacs+flymake+jsc

For GNU Emacs users, jsc provides a flymake compatible output. So you can use jsc+flymake to have a syntax check tool running in the background while editing your javascript files. Look at the wiki page for more info.

Emacs snippet

Do you want to compile your code right from Emacs?

Copy

plugins/jsc.el

to your emacs load-path and restart Emacs.

Now, select the code to compile and run:

  • CcJe to check for errors

  • CcJw to check for warnings.

Copyright © 2010 Davide Saurino. See LICENSE for details.