运行grunt任务两次导致错误无法调用未定义的方法'forEach'使用

时间:2017-04-17 14:04:10

标签: javascript node.js gruntjs purifycss

grunt新手我已成功使用它来运行purifycss。现在我想用不同的参数运行purifycss两次,然后理想地将两个结果文件连接起来。 到目前为止我所拥有的是Gruntfile

module.exports = function(grunt) {

  grunt.initConfig({
    purifycss: {
      bootstrap: {
        options: {},
        target: {
              src: [ 'live/*.twig' ],
              css: ['live/css/bootstrap*.css'],
              dest: 'purified_bootstrap.css'
                }
            },
      mycss: {
        options: {},
        target: {
              src: [ 'live/*.twig' ],
              css: ['live/css/mycss.css'],
              dest: 'purified_mycss.css'
                }
            }
      }
  });

  grunt.loadNpmTasks('grunt-purifycss');
  grunt.registerTask('purify', ['purifycss:bootstrap', 'purifycss:mycss']);
};

从终端运行grunt purify时得到的输出:

> grunt purify
Running "purifycss:bootstrap" (purifycss) task
Warning: Cannot call method 'forEach' of undefined Use --force to continue.
Aborted due to warnings.

对这里出了什么问题的任何帮助表示赞赏!

0 个答案:

没有答案