Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I preserve directory structure when compiling CoffeeScript?

I am new to Coffeescript and I wonder where I should put them.

Eg. I have my app folder:

app/app.js
tests/unit/all.js
etc

When I use the "coffee" runner on node.js to watch my files in the root folder it will generate js files to a folder I specify eg. js.

So if the folder to be watched is looking like this:

app/app.coffee
tests/unit/all.coffee
etc

JS files will be generated to:

js/app.js
js/all.js
etc

As you can see I lose my js folder hierarchy.

How are you supposed to retain your original folder hierarchy?

Thanks

like image 346
ajsie Avatar asked Sep 28 '11 21:09

ajsie


1 Answers

I believe you want

coffee -cwo js .

That will compile app/foo.coffee to js/app/foo.js, and test/bar.coffee to js/test/bar.js.

As long as you stick to passing folder names to the coffee command, rather than individual file names, directory structure will be preserved.

like image 100
Trevor Burnham Avatar answered Oct 14 '22 04:10

Trevor Burnham