Skip to content

Command line interface

jeffsu edited this page Mar 6, 2011 · 2 revisions

There are 3 main commands that can be run in js2:

js2 compile

Compile takes 2 arguments: source and destination. Source is the directory of the js2 and destination is the desired path for the outputted javascript. Add an optional "-r" to recursively traverse the source directory. Add an optional "-m=browser" (m for mode) to compile browser friendly javascript. Other modes include ringo and node. js2 compile -r -m=node src/ lib/

js2 watch

This behaves exactly like compile, but loops every few seconds to check up on changed files. You can control the time between loops by setting "-i=N" where N is the number of seconds. js2 watch -r -m=node src/ lib/

js2 render

Render takes a js2 file and prints the equivalent javascript. It will also use the "-m" switch. js2 render -m=node foo.js2

Clone this wiki locally