I’ve actually been using Grunt for a lot of my projects at work. The installation work for Grunt is the most annoying part of the process, given that it’s so repetitive and tedious. This is especially true If you’re running with Grunt as part of your repo and you have to set it up every time you make a build for a project. I found a couple of things pretty early on that this can be made much smoother for your fellow project members:
- Ignore the node_modules/ dir, it doesn’t belong in the repo, makes a mess, and can cause strange Grunt bugs
- Make a shell script to install Grunt and your dependencies so someone can easily pull down your branch, run the shell script and be ready to contribute:
grunt-deps.sh:
npm install grunt —save-dev
npm install -g grunt-cli
# Above is nice because even if the user already has these installed, it won’t do anything unnecessary.
echo “grunt installedn”
You call this script by going to your project root (same place you’d want to run Grunt from) and running sh grunt-deps.sh. So each time you add a new plugin to Grunt, just add a new line to this file. Boom, easy, painless project init.
- Set your source and destination files as a module and call those in your subsequent config blocks:
dirs:{
// To be more future-minded, we’ll move sass under
// tools, which will house our js in the future.
sass: ‘sass’,
dest: ‘wp-content/themes/internap_2’,
jsDest: ‘<%= dirs.dest %>/lib/js’,
jsSrc: ‘’,
},
watch:{
sass: {
files: ‘<%= dirs.sass %>/**/*.scss’,
tasks: [‘sass:normal’, ‘sass:ie’]
},
}
I’ve actually been using Grunt for a lot of my projects at work. The installation work for Grunt is the most annoying part of the process, given that it’s so repetitive and tedious. This is especially true If you’re running with Grunt as part of your repo and you have to set it up every time you make a build for a project. I found a couple of things pretty early on that this can be made much smoother for your fellow project members:
- Ignore the node_modules/ dir, it doesn’t belong in the repo, makes a mess, and can cause strange Grunt bugs
- Make a shell script to install Grunt and your dependencies so someone can easily pull down your branch, run the shell script and be ready to contribute:
grunt-deps.sh: npm install grunt —save-dev npm install -g grunt-cli # Above is nice because even if the user already has these installed, it won’t do anything unnecessary. echo “grunt installedn”
echo “grunt-contrib-concat” npm install grunt-contrib-concat —save-devYou call this script by going to your project root (same place you’d want to run Grunt from) and running sh grunt-deps.sh. So each time you add a new plugin to Grunt, just add a new line to this file. Boom, easy, painless project init.
- Set your source and destination files as a module and call those in your subsequent config blocks: dirs:{ // To be more future-minded, we’ll move sass under // tools, which will house our js in the future. sass: ‘sass’, dest: ‘wp-content/themes/internap_2’, jsDest: ‘<%= dirs.dest %>/lib/js’, jsSrc: ‘’, }, watch:{ sass: { files: ‘<%= dirs.sass %>/**/*.scss’, tasks: [‘sass:normal’, ‘sass:ie’] }, }