Gruntjs 咕噜咖啡有多重任务?

Gruntjs 咕噜咖啡有多重任务?,gruntjs,grunt-contrib-watch,grunt-contrib-concat,grunt-contrib-coffee,Gruntjs,Grunt Contrib Watch,Grunt Contrib Concat,Grunt Contrib Coffee,所以,我有一个项目的布局是 src --library ----a.coffee ----b.coffee ----c.coffee --demo ----main.coffee 我目前已经设置grunt,将src/library中的coffeescript编译成intermediate/library,将结果连接到intermediate/library.js并放入dist 这很好,但现在我也想看src/demo并做同样的事情,我该怎么做呢 我的grunt文件是: module.export

所以,我有一个项目的布局是

src
--library
----a.coffee
----b.coffee
----c.coffee
--demo
----main.coffee
我目前已经设置grunt,将src/library中的coffeescript编译成intermediate/library,将结果连接到intermediate/library.js并放入dist

这很好,但现在我也想看src/demo并做同样的事情,我该怎么做呢

我的grunt文件是:

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"]

好的,我已经解决了

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"
比如说