看不到useminPrepare的结果

时间:2014-02-19 23:18:46

标签: build gruntjs grunt-usemin

Yeoman构建任务打破我的应用程序开箱即用,我试图看看问题出在哪里。

所以我评论了其他任务,只留下了:

grunt.registerTask('build', [
    'clean:dist',
    'useminPrepare',
]);

useminPrepre任务定义如下:

useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>',
                flow: {
                    steps: {'js': ['concat']},
                    post: {}
                }
            }
        },

输出(见下文)似乎没问题,但是一旦构建完成,dist文件夹就是空的。如何让useminprepare实际写入文件?

Running "useminPrepare:html" (useminPrepare) task
Going through C:/development/projects/yadazing/bb_ui/app/index.html to update the config
Looking for build script HTML comment blocks

Configuration is now:

  concat:
  { generated:
   { files:
      [ { dest: '<APP_PATH> \\dist\\scripts\\scripts.js',
          src:
           [ '{.tmp,app}\\bower_components\\jquery\\jquery.js',
             <APP_COMPONENTS>\\angular.js'
             .
             .
             ] },

        { dest: ''<APP_PATH>\\dist\\scripts\\modules.js',
          src:
           [ '<APP_MUDULES>\\app\\scripts\\app.js',
             '<APP_MUDULES>\\app\\scripts\\settings.js',
              .
              .
              ]}]}}

Done, without errors.


Execution Time (2014-02-19 22:46:34 UTC)
loading tasks        5ms  
clean:dist           5ms  
useminPrepare:html  26ms
Total 37ms

1 个答案:

答案 0 :(得分:0)

所有useminprepare都会修改其他 grunt任务的配置。要查看生成的任务配置的结果,您需要在之后运行这些任务。

任务集合及其执行顺序称为flow。默认情况下,流量为concat -> uglifyjs,但您可以编写自己的流量。

使用您需要执行的默认流程:

grunt.registerTask( 'lala', ['useminprepare', 'concat', 'uglify'] ); 

查看结果。