I'm new to the Grunt world.
After installing grunt-cli, and all the dependencies, here is my : Gruntfile.js
/*
Grunt installation:
-------------------
npm install -g grunt-cli
npm install -g grunt-init
npm init (creates a `package.json` file)
Project Dependencies:
---------------------
npm install grunt --save-dev
npm install grunt-contrib-concat --save-dev
npm install grunt-contrib-watch --save-dev
Example Usage:
--------------
grunt -v
grunt release -v
*/
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
concat: {
js: {
src: ['js/bootstrap.min.js', 'js/jquery-1.10.2.min.js'],
dest: 'build/js/scripts.js'
},
css: {
src: ['css/bootstrap.min.css', 'css/font-awesome.min.css'],
dest: 'build/css/styles.css'
}
},
watch: {
js: {
files: ['js/**/*.js'],
task: ['concat:js']
},
css: {
files: ['css/**/*.css'],
task: ['concat:css']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasksNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['concat', 'watch']);
};
Now the testing part, I tried run grunt
, I kept getting :
Loading "Gruntfile.js" tasks...ERROR
>> TypeError: undefined is not a function
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
Can someone please tell me what did I do wrong here ?
It looks like the default
target is not being created properly due to a typo. Try renaming
grunt.loadNpmTasksNpmTasks('grunt-contrib-watch');
to
grunt.loadNpmTasks('grunt-contrib-watch');