CoffeeScript - compile all .coffee files in current directory and all sub-directories

后端 未结 4 1144
离开以前
离开以前 2021-02-05 04:06

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

相关标签:
4条回答
  • 2021-02-05 04: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

    0 讨论(0)
  • 2021-02-05 04:48

    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

    0 讨论(0)
  • 2021-02-05 05:00
    coffee -c .
    

    Thanks @TrevorBurnham

    0 讨论(0)
  • 2021-02-05 05:03
    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
    
    0 讨论(0)
提交回复
热议问题