Reputation: 33
module.exports = function(grunt){
'use strict';
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//Lint JavaScript (validate JS)
jshint: {
all: {
options: {
force: true
},
src: ['Gruntfile.js', 'source/js/*.js', 'source/views/js/*.js']
}
},
// Lint CSS (validate CSS)
csslint: {`enter code here`
lax: {
options: {
force: true
},
src: ['source/css/*.css', 'source/views/css/*.css']
}
},
//Clean and New folder for optimized code
clean: {
dev: {
src: ['dest/'],
},
},
mkdir: {
dev: {
options: {
create: ['dest/']
},
},
},
//Copy thee files in 'dest' folder
copy: {
main: {
files: []
{expand: true, cwd: 'source/', src: ['**'], dest: 'dest/'}
],
},
},
//JS Minification
uglify: {
my_target: {
files: [{
expand: true,
cwd: 'dest/js',
src: ['*.js'],
dest: 'dest/js'
},{
expand: true,
cwd: 'dest/views/js',
src: ['*.js'],
dest: 'dest/views/js'
}]
}
},
//CSS Minification
cssmin: {
target: {
files: [{
expand: true,
cwd: 'dist/css',
src: ['*.css'],
dest: 'dist/css',
ext: '.css'
},{
expand: true,
cwd: 'dist/views/css',
src: ['*.css'],
dest: 'dist/views/css',
ext: '.css'
}]
}
},
// resize images from pizza
responsive_images: {
dev: {
options: {
engine: 'im',
sizes: [{
width: 77,
quality: 60
},{
width: 116,
quality: 60
},{
width: 232,
quality: 60
},{
width: 720,
quality: 60
}]
},
files: [{
expand: true,
src: ['**.{gif,jpg,png}'],
cwd: 'dest/views/images/',
dest: 'dest/views/images/'
}]
}
}
});
grunt.registerTask('default', [
'jshint',
'csslint',
'clean',
'mkdir',
'copy',
'uglify',
'cssmin',
'responsive_images'
]);
};
Running grunt in Command Prompt gives ERROR:
Loading "gruntfile.js" tasks...ERROR >> SyntaxError: Unexpected token Warning: Task "default" not found. Use --force to continue.
I don't know where i have gone wrong..Any Help is Appreciated!
Upvotes: 0
Views: 3467
Reputation: 884
You have typo in your gruntfile.
Change
// ... config before
copy: {
main: {
files: []
{expand: true, cwd: 'source/', src: ['**'], dest: 'dest/'}
],
},
},
// ... config after
To:
// ... config before
copy: {
main: {
files: [ //removed array close
{expand: true, cwd: 'source/', src: ['**'], dest: 'dest/'}
]
}
},
// ... config after
Upvotes: 1