1

以下を追加することで、grunt コマンドを使用して Gruntfile を編集し、CoffeeScript ファイルを処理することができました。

grunt.initConfig({

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

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

しかし、変更を加えてテストするたびに手動で "grunt" する必要がないため、CoffeeScript 処理を Grunt 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 に答える