Reputation: 1078
I'm taking my first steps with Grunt, however I'm getting to following error when trying to minify my JS file:
"Task "default" not found"
I've checked previous similar answers but to no avail. The Gruntfile code is below, can anybody point me in the right direction please?
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
src: [
'js/libs/*.js' //
],
dest: 'js/build/production.js',
}
}
uglify: {
build: {
src: 'js/build/production.js',
dest: 'js/build/production.min.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['concat', 'uglify']);
};
Thanks!
Upvotes: 0
Views: 75
Reputation: 4279
You have a syntax error in your grunt.initConfig
object. You need to place a comma after the closing brace of your concat
entry:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
src: [
'js/libs/*.js' //
],
dest: 'js/build/production.js',
}
}, // <-- missing comma was here
uglify: {
build: {
src: 'js/build/production.js',
dest: 'js/build/production.min.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['concat', 'uglify']);
};
This syntax error causes Grunt to never see your grunt.registerTask('default')
call.
Upvotes: 1