最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I preserve directory structure when compiling CoffeeScript? - Stack Overflow

programmeradmin1浏览0评论

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

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

Share Improve this question edited Sep 28, 2011 at 23:31 Trevor Burnham 77.4k33 gold badges163 silver badges199 bronze badges asked Sep 28, 2011 at 21:33 ajsieajsie 79.7k110 gold badges284 silver badges386 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 21

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.

It's not advised to do recursive watches, but for discussion on look here: https://github.com/jashkenas/coffee-script/issues/932

发布评论

评论列表(0)

  1. 暂无评论