我有一个包含对js文件的引用的html文件.我想解析它提取引用的js文件列表和feed contrib-concat或任何其他任务.有没有方便的方法将一个grunt任务的输出用作另一个的输入?
使用grunt.config。这是一个例子:
grunt.initConfig({
  concat: {
    js: {
      src: ['default/concat/files/*'],
      dest: ['dist/javascript.js'],
    },
  },
});
grunt.registerTask('extractjs', function() {
  /* Do the js extraction */
  // Overwrite the concat.js.src with your extracted files.
  grunt.config(['concat', 'js', 'src'], extractedFiles);
});
所以现在当你运行时grunt extractjs concat它将提取js,然后连接提取的js文件。查看此任务: https: //github.com/cgross/grunt-dom-munger,因为他正在努力实现类似的目标。这是一个带有更多示例的 grunt 问题:https://github.com/gruntjs/grunt/issues/747