我遵循了以下教程: 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/