module.exports = function (grunt) { require(‘load-grunt-tasks‘)(grunt); var path = { src : ‘src‘, dest : ‘dist‘, tmp : ‘.tmp‘ } grunt.initConfig({ path : path, clean : { beforebuild : { files : [{ src : [‘<%= path.dest %>/‘, ‘<%= path.tmp %>/‘] } ] } }, filerev : { build : { files : [{ src : [‘<%= path.dest %>/**‘, ‘!<%= path.dest %>/**/*.html‘] } ] } }, useminPrepare : { build : { options: { root: [ ‘<%= path.src %>‘,‘<%= path.src %>/html‘,‘<%= path.src %>/image‘,‘<%= path.src %>/js‘//也可以‘<%= path.src %>/**‘ ], dest:‘<%= path.dest %>/html‘ }, files : [{ src : ‘<%= path.src %>/**/*.html‘ } ] } }, usemin : { options: { assetsDirs: [ ‘<%= path.dest %>‘,‘<%= path.dest %>/html‘,‘<%= path.dest %>/image‘,‘<%= path.dest %>/js‘ ], patterns:{ js:[ [/(image\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, ‘Update the Js to reference our revved images‘] ] } }, html : { files : [{ src : ‘<%= path.dest %>/**/*.html‘ } ] }, css : { files : [{ src : ‘<%= path.dest %>/css/**/*.css‘ } ] }, js : { files : [{ src : ‘<%= path.dest %>/js/**/*.js‘ } ] } }, copy : { build : { files : [{ expand : true, cwd : ‘<%= path.src %>/‘, src : [‘**/*.html‘], dest : ‘<%= path.dest %>/‘ } ] } }, imagemin : { build : { files : [{ expand : true, cwd : ‘<%= path.src %>‘, src : [‘**/*.{jpg, png, jpeg, gif}‘], dest : ‘<%= path.dest %>/‘ } ] } } }); grunt.registerTask(‘default‘, [‘clean:beforebuild‘, ‘copy‘, ‘imagemin‘, ‘useminPrepare‘, ‘concat‘, ‘cssmin‘, ‘uglify‘, ‘filerev‘, ‘usemin‘]); };
没有解决 Different sources attempting to write to the same destination 问题。
时间: 2024-11-05 17:32:16