Reputation: 1734
I'm new to grunt js. I'm trying to build multiple tasks with grunt js but each time i got error. How to out from this issue? Here's the my example code.
module.exports = function(grunt){
grunt.initConfig({
useminPrepare:{
html:['app/index.html'],
options:{
dest:'build'
}
},
usemin:{html:['build/index.html']},
copy:{
task0: {
src:['app/index.html', 'app/index2.html'],
dest:['build/index.html', 'build/index2.html']
}
}
});
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('build',[
'copy:task0',
'useminPrepare',
'concat',
'cssmin',
'uglify',
'usemin'
])
}
Upvotes: 0
Views: 101
Reputation: 2121
You're missing a semi-colon after registerTask
, should be:
grunt.registerTask('build',[
'copy:task0',
'useminPrepare',
'concat',
'cssmin',
'uglify',
'usemin'
]);
Upvotes: 1
Reputation: 9295
From the little information you provided, I am guessing that you are running grunt build
.
I can see that you are missing some tasks definition as one of the answers points out, but also dest
attribute should be a string. You can see it in the documentation: https://github.com/gruntjs/grunt-contrib-copy#usage-examples
Here is example for your case:
copy:{
task0: {
src:['app/index.html', 'app/index2.html'],
dest: 'build/'
}
}
note that the missing tasks are: concat, cssmin, uglify
Upvotes: 1