This is my first test in grunt:). Anyway,I want to test my javasrcipt code using the different grunt modules. They are all installed and you can see them,in a json file called package.json.
{
"name": "LarissaCity",
"private": true,
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.1.0",
"jit-grunt": "^0.10.0",
"jshint-stylish": "^2.2.1",
"time-grunt": "^1.4.0"
},
"engines": {
"node": ">=0.10.0"
}
}
Next I have a file called Gruntfile.js. And inside it use the installed modules to test my javascript code. So.
'use strict';
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Automatically load required Grunt tasks
require('jit-grunt')(grunt);
// Define the configuration for all the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'app/scripts/{,*/}*.js'
]
}
}
});
grunt.registerTask('build', [
'jshint'
]);
grunt.registerTask('default',['build']);
When I type grunt in the cmd this comes up.
Loading "Gruntfile.js" tasks...ERROR
ReferenceError: grunt is not defined
So maybe there is something wrong in the Gruntfile.js. Any ideas?
Thanks,
Theo.
require('grunt')?