【问题标题】:Adding CoffeeScript support for Grunt Delta?为 Grunt Delta 添加 CoffeeScript 支持?
【发布时间】:2013-08-06 09:53:56
【问题描述】:

我能够编辑我的 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
    }
  }
}

【问题讨论】:

    标签: gruntjs


    【解决方案1】:

    这是我想出的:

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

    似乎有效。

    【讨论】:

      猜你喜欢
      • 2021-02-01
      • 1970-01-01
      • 2017-09-30
      • 1970-01-01
      • 2019-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多