As mentioned in title, it happens when I run Grunt, and I can't figure out what is wrong with my code. I used JShint to check it, and there is no errors.
function () {
'use strict';
}
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: 'rn'
},
dist: {
src: ['development/js/**/*js'],
dest: 'development/js/piled.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */n'
},
dist: {
files: {
'dist/js/main.min.js': ['<%= concat.dist.dest %>']
}
}
},
jshint: {
files: ['development/js/**/*js'],
options: {
globals: {
jQuery: true,
console: true,
module: true
}
}
},
pass: {
dist: {
options: {
sassDir: 'development/css',
cssDir: 'dist/css',
environment: 'production',
outputStyle: 'pressed'
}
}
},
copy: {
files: [
{
cwd: 'development', // set working folder / root to copy
src: '**/*html', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
},
{
cwd: 'development', // set working folder / root to copy
src: 'img/*', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
},
{
cwd: 'development', // set working folder / root to copy
src: 'fonts/*', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
},
{
cwd: 'path/to/files', // set working folder / root to copy
src: '**/*', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
}
]
},
watch: {
files: ['<%= jshint.files %>', 'development/css/**/*.scss', 'development/**/*html'],
tasks: ['concat', 'uglify', 'jshint', 'pass']
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-pass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', [
'concat',
'uglify',
'jshint',
'pass',
'copy'
]);
};
Console output:
Loading "Gruntfile.js" tasks...ERROR
SyntaxError: Unexpected token ( Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
As mentioned in title, it happens when I run Grunt, and I can't figure out what is wrong with my code. I used JShint to check it, and there is no errors.
function () {
'use strict';
}
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: 'rn'
},
dist: {
src: ['development/js/**/*js'],
dest: 'development/js/piled.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */n'
},
dist: {
files: {
'dist/js/main.min.js': ['<%= concat.dist.dest %>']
}
}
},
jshint: {
files: ['development/js/**/*js'],
options: {
globals: {
jQuery: true,
console: true,
module: true
}
}
},
pass: {
dist: {
options: {
sassDir: 'development/css',
cssDir: 'dist/css',
environment: 'production',
outputStyle: 'pressed'
}
}
},
copy: {
files: [
{
cwd: 'development', // set working folder / root to copy
src: '**/*html', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
},
{
cwd: 'development', // set working folder / root to copy
src: 'img/*', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
},
{
cwd: 'development', // set working folder / root to copy
src: 'fonts/*', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
},
{
cwd: 'path/to/files', // set working folder / root to copy
src: '**/*', // copy all files and subfolders
dest: 'dist', // destination folder
expand: true // required when using cwd
}
]
},
watch: {
files: ['<%= jshint.files %>', 'development/css/**/*.scss', 'development/**/*html'],
tasks: ['concat', 'uglify', 'jshint', 'pass']
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-pass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', [
'concat',
'uglify',
'jshint',
'pass',
'copy'
]);
};
Console output:
Share Improve this question asked Dec 13, 2015 at 17:17 jazzgotjazzgot 4191 gold badge3 silver badges17 bronze badgesLoading "Gruntfile.js" tasks...ERROR
SyntaxError: Unexpected token ( Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
1 Answer
Reset to default 3First function has a syntax error, try to change first function to:
(function(){
"use strict";
// Define your library strictly...
})();