How to save directory structure when compiling CoffeeScript?

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

Eg. I have a folder for the application:

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

When I use coffee on node.js to watch my files in the root folder, it will generate js files in the folder that I specify, for example. JS.

So, if the folder you are browsing looks like this:

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

JS files will be generated for:

 js/app.js js/all.js etc 

As you can see, I am losing the hierarchy of js folders.

How should you keep the original folder hierarchy?

thanks

+6
source share
2 answers

I believe you want

 coffee -cwo js . 

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

As long as you save the names of the transferred folders in the coffee command, and not the individual file names, the directory structure will be preserved.

+21
source

It is not recommended to make a recursive clock, but for a discussion, see here: https://github.com/jashkenas/coffee-script/issues/932

+1
source

Source: https://habr.com/ru/post/898240/


All Articles