Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CoffeeScript - compile all .coffee files in current directory and all sub-directories

Tags:

coffeescript

What is the easiest way to compile all .coffee files in the current directory and all sub-directories?

like image 765
William Avatar asked Jan 11 '12 09:01

William


People also ask

How do I compile a CoffeeScript file?

The CoffeeScript files are saved with the extension .coffee. You can compile these files using the -c or --compile option of the coffee command as shown below. Suppose there is a file in your system with the following CoffeeScript code which prints a message on the console.

What is the CoffeeScript command now called?

The coffeescript command is now called coffee. The official CoffeeScript extension is now .coffee instead of .cs, which properly belongs to C#. Due to popular demand, you can now also use = to assign.

How to run CoffeeScript on Node JS?

On installing CoffeeScript on Node.js, we can access the coffee-command line utility. In here, the coffee command is the key command. Using various options of this command, we can compile and execute the CoffeeScript files. You can see the list of options of the coffee command using its -h or --help option.

How to require CoffeeScript from cakefiles?

The %% operator now coerces its right operand only once. It is now possible to require CoffeeScript files from Cakefiles without having to register the compiler first. The CoffeeScript REPL is now exported and can be required using require 'coffeescript/repl'.


1 Answers

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

like image 145
fbuchinger Avatar answered Sep 30 '22 09:09

fbuchinger