CoffeeScript - compile all .coffee files in curren

2019-03-17 09:03发布

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

4条回答
别忘想泡老子
2楼-- · 2019-03-17 09:27
coffee --watch --compile .

or

coffee -wc .

Either of these commands will run forever, watching for *.coffee files in the current directory, and compiling those *.coffee files into *.js JavaScript files whenever the *.coffee files are changed.

If you want the *.js files to be generated into some other directory, just add --output or -o, like this:

coffee --watch --output lib --compile src

or

coffee -w -o lib -c src
查看更多
何必那么认真
3楼-- · 2019-03-17 09:30

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

查看更多
萌系小妹纸
4楼-- · 2019-03-17 09:46

If you are using *nix systems:

find -name "*.coffee" -exec coffee -c {} \;

and you may also consider using Guard: https://github.com/guard/guard-coffeescript

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-03-17 09:50
coffee -c .

Thanks @TrevorBurnham

查看更多
登录 后发表回答