Join multiple Coffeescript files into one file? (Multiple subdirectories)

前端 未结 7 1783
臣服心动
臣服心动 2020-12-31 13:19

I\'ve got a bunch of .coffee files that I need to join into one file.

I have folders set up like a rails app:

/src/controller/log_controller.coffee
/         


        
相关标签:
7条回答
  • 2020-12-31 14:13

    Use cake to compile them all in one (or more) resulting .js file(s). Cakefile is used as configuration which controls in which order your coffee scripts are compiled - quite handy with bigger projects.

    Cake is quite easy to install and setup, invoking cake from vim while you are editing your project is then simply

    :!cake build
    

    and you can refresh your browser and see results.

    As I'm also busy to learn the best way of structuring the files and use coffeescript in combination with backbone and cake, I have created a small project on github to keep it as a reference for myself, maybe it will help you too around cake and some basic things. All compiled files are in www folder so that you can open them in your browser and all source files (except for cake configuration) are in src folder. In this example, all .coffee files are compiled and combined in one output .js file which is then included in html.

    0 讨论(0)
提交回复
热议问题