1

我能够编辑我的 Gruntfile 以使用 grunt 命令处理我的 CoffeeScript 文件,方法是添加:

grunt.initConfig({

  coffee: {
      compile: {
          options: {
              bare: true,
              join: true,
              sourceMap: true
          },

          files: {
              'src/coffee.js' : ['src/app/**/*.coffee', 'src/components/**/*.coffee']
          }
      }
  }, 
...

但我似乎无法弄清楚如何将 CoffeeScript 处理添加到 Grunt Delta 命令,因为我不想每次进行更改和测试时都必须手动“咕噜”。我当前的增量文件。希望获得有关如何使 delta 与 CoffeeScript 一起工作的方向。

 delta: {
  /**
   * By default, we want the Live Reload to work for all tasks; this is
   * overridden in some tasks (like this file) where browser resources are
   * unaffected. It runs by default on port 35729.
   */
  options: {
    livereload: true
  },

  /**
   * When the Gruntfile changes, we just want to lint it. That said, the
   * watch will have to be restarted if it should take advantage of any of
   * the changes.
   */
  gruntfile: {
    files: 'Gruntfile.js',
    tasks: [ 'jshint:gruntfile' ],
    options: {
      livereload: false
    }
  },

  /**
   * When our source files change, we want to run most of our build tasks
   * (excepting uglification).
   */
  src: {
    files: [
      '<%= src.js %>'
    ],
    tasks: [ 'jshint:src', 'karma:unit:run', 'concat:dist', 'ngmin:dist', 'uglify:dist' ]
  },

  /**
   * When assets are changed, copy them. Note that this will *not* copy new
   * files, so this is probably not very useful.
   */
  assets: {
    files: [
      'src/assets/**/*'
    ],
    tasks: [ 'copy' ]
  },

  /**
   * When index.html changes, we need to compile just it.
   */
  html: {
    files: [ '<%= src.html %>' ],
    tasks: [ 'index' ]
  },

  /**
   * When our templates change, we only add them to the template cache.
   */
  tpls: {
    files: [
      '<%= src.atpl %>',
      '<%= src.ctpl %>'
    ],
    tasks: [ 'html2js', 'concat:dist', 'ngmin:dist', 'uglify:dist' ]
  },

  /**
   * When the CSS files change, we need to compile and minify just them.
   */
  sass: {
    files: [ 'src/**/*.scss' ],
    tasks: 'compassCompile'
  },

  envs: {
    files: [
      'environment.json'
    ],

    tasks: ['build']
  },

  /**
   * When a unit test file changes, we only want to linit it and run the
   * unit tests. However, since the `app` module requires the compiled
   * templates, we must also run the `html2js` task.
   */
  unittest: {
    files: [
      '<%= src.unit %>'
    ],
    tasks: [ 'jshint:test', 'karma:unit:run' ],
    options: {
      livereload: false
    }
  }
}
4

1 回答 1

0

这就是我想出的:

   coffeesrc: {
        files: [
            'src/app/**/*.coffee', 'src/components/**/*.coffee'
        ],
        tasks: [ 'coffee' ]
    },

似乎工作。

于 2013-08-06T01:53:56.013 回答