Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep coffeescript file and its compiled version in different folders?

Tags:

coffeescript

I want my file/foder structure be clean on my website. So I don't want coffescript file be in the same folder as its compiled version.

While developing I'm using --watch key of compiler. I used this command before

coffee -cw ./ ./

which worked fine recursively for all coffeescript files when launching this from root of the website. But there is one problem - it puts compiled files in the same folder, which I try to avoid.

Is it possible to say to the compile - "please compile every coffeescript file and put compiled version in the parent folder"?

Update:

OK. A little bit of a clarification here. I.e. I have this folder structure

app
  |- css
  |- images
  |- js
      |- coffee
      |- libs
      |- controllers
               |- coffee
      |- services
               |- coffee
               |- loggers
                      |- coffee

As you can guessed I want to store all my coffeescript files inside coffee folders, but compile them into the parent folder. E.g. I want to add one more logger, then I add newLogger.coffee inside app/js/services/loggers/coffee and compiler compiles it and put newLogger.js inside app/js/services/loggers.

I can use this command inside each coffee folder

 coffee -cw -o ../ ./

So, in this case with 4 coffee folders I have 4 compiler instances running for each of them. Can I replace them with one instance?

like image 630
Vitalii Korsakov Avatar asked Jan 24 '26 01:01

Vitalii Korsakov


1 Answers

from coffeescript docs:

Compile a directory tree of .coffee files in src into a parallel tree of .js files in lib:

coffee --compile --output lib/ src/
like image 190
nicksweet Avatar answered Jan 26 '26 19:01

nicksweet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!