javascript - Grunt usemin 未找到目标

标签 javascript gruntjs yeoman grunt-usemin gruntfile

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

并不断收到“找不到”“usemin”目标。

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

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

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

谢谢

最佳答案

问题出在 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'
]);



};

关于javascript - Grunt usemin 未找到目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32137557/

相关文章:

javascript - 我如何防止 bower 下载整个 repo 协议(protocol)

javascript - Canvas 游戏 : Maximum steering angle in n seconds

javascript - 使用 IIFE 来避免名称冲突?

less - Grunt 0.4 少任务 : How to not concatenate destination files

gruntjs - 通配符包括

backbone.js - Yeoman Backbone 脚手架是 120MB 和 11K 文件?

yeoman - 更新 Yeoman 生成器的首选方式是什么?

javascript - setTimeout 在 react setState 中

javascript - 如何在 Javascript 中传递 HTML 数据

javascript - 变量可以同时是对象和未定义吗?