The package file
The package file provides Grunt a lot of information. This is the file used to list the name of the project but also any and all dependencies our project will use. The file needs to have a few things in order for grunt to know what to do.
- Name
- The name of your project.
- Description
- A short description of the project.
- License
- The license of your project.
- People
- Where you list the author or contributors of the project.
- Repository
- Bitbucket, Github or if your project is hosted somewhere.
- devDependencies
- What is installed when run
grunt install
command
A quick example can be taken from the grunt site:
{ "name": "mccoolsville", "version": "0.1.0", "description": "Super fly and dope project description", "devDependencies": { "grunt": "~0.4.5", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-uglify": "~0.5.0" } }
You don’t need to have all the above listed but you do at least need the name and version of the project. The bower.json
file is coded in almost the same manner.
{ "name": "secret-squirrel", "version": "0.1.0", "description": "Super awesome project", "devDependencies": { "susy": "~2.2.12" } }
Now, we need our Gruntfile
in order to list all the tasks and configure them.