0

所以,我有一個項目與咕嚕咖啡多任務?

src 
--library 
----a.coffee 
----b.coffee 
----c.coffee 
--demo 
----main.coffee 

佈局我有咕嚕設置當前編譯中的src /庫中/庫的CoffeeScript,CONCAT的結果,中間/ library.js,放入DIST

這工作正常,但現在我也想看src/demo並做同樣的事情,我會怎麼做呢?

我的呼嚕聲文件是:

module.exports = (grunt) -> 
    grunt.loadNpmTasks("grunt-contrib-coffee") 
    grunt.loadNpmTasks("grunt-contrib-watch") 
    grunt.loadNpmTasks("grunt-contrib-concat") 

    grunt.initConfig 
    watch: 
     coffee: 
     files: "src/library/**/*.coffee" 
     tasks: ["coffee:compile", "concat"] 

    coffee: 
     compile: 
     expand: true, 
     flatten: true, 
     cwd: "src/library", 
     src: ["**/*.coffee"], 
     dest: "intermediate/library/", 
     ext: ".js" 

    concat: 
     options: 
     separator: ";" 
     dist: 
     src: ["intermediate/library.js", "intermediate/library/**/*.js"] 
     dest: "dist/library.js" 

    grunt.registerTask "default", ["watch"] 

回答

0

好吧,我的工作了。

watch: # specific name for the task that I want to run 
    anyName: # name of my specific configuration of the task 

這樣我就可以例如

concat: 
    options: 
    separator: ";" 
    library: 
    src: ["intermediate/library.js", "intermediate/library/**/*.js"] 
    dest: "dist/library.js" 
    demo: 
    src: ["intermediate/demo.js", "intermediate/demo/**/*.js"] 
    dest: "dist/demo.js"