Ворчать кофе несколько задач?

Итак, у меня есть проект с макетом

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

В настоящее время я настроил grunt, чтобы скомпилировать coffeescript из src/library в промежуточный/библиотеку, объединить результаты в промежуточный/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"]

person Michael Baldry    schedule 27.05.2015    source источник


Ответы (1)


Хорошо, я разобрался.

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"

Например

person Michael Baldry    schedule 28.05.2015