What is the easiest way to compile all .coffee files in the current directory and all sub-directories?
If you are using *nix systems:
find -name "*.coffee" -exec coffee -c {} \;
and you may also consider using Guard
: https://github.com/guard/guard-coffeescript
you can do so with the integrated coffee
shell tool:
coffee --output lib --compile src
compiles a directory tree of .coffee files in src
into a parallel tree of .js files in lib
.
Check http://coffeescript.org/#usage for more details
coffee -c .
Thanks @TrevorBurnham
coffee --watch --compile .
or
coffee -wc .
Either of these commands will run forever, watching for *.coffee files in the current directory, and compiling those *.coffee files into *.js JavaScript files whenever the *.coffee files are changed.
If you want the *.js files to be generated into some other directory, just add --output or -o, like this:
coffee --watch --output lib --compile src
or
coffee -w -o lib -c src