Grunt usemin没有找到目标

时间:2015-08-21 09:59:22

标签: javascript gruntjs yeoman grunt-usemin gruntfile

我遵循了以下教程: https://www.youtube.com/watch?v=gIbfDxF69c8

并继续获得No" usemin"找到目标。

gruntfile.js: http://www.billiving.com/demo/script/gruntfile.js

源文件: /script/app/index.html /script/app/js/file2.js

该过程失败,结果index.html不包含指向缩小的js文件的链接。

由于

2 个答案:

答案 0 :(得分:2)

问题在于usemin路径..在详细模式下工作时我能够弄明白。这是我的最终输出:

module.exports = function(grunt) {
    grunt.initConfig({

    useminPrepare:{
          html: 'index.html',
          options:{
              dest:'build'
            }
    },

    usemin: {
      html: 'build/index.html'
     },



    copy :{

        task1: {expand: true, src: ['Partials/**', 'Nav/**', 'Resources/Images/**', 'Resources/packages/**', 'Resources/invoices/**', 
        'config.js', 'index.html', 'favicon.ico'], dest:'build/'},
    }       

});

grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-usemin');


grunt.registerTask('default',[
  'copy:task1',
  'useminPrepare',
  'concat',
  'uglify',
  'cssmin',
  'usemin'
]);



};

答案 1 :(得分:0)

你输了一个错字,usemin:而不是usermin: