I know that I am late to the party, but I have been doing more web development in my free time and I have discovered Grunt! I was so happy to have a tool that would minify my code automatically. After learning about the different packages and setting up my Gruntfile.js I needed up update my Jenkins server to run my Grunt tasks as part of my build plan.
Getting Jenkins to execute my Grunt script turned out to be a relatively easy task with a NodeJS plugin for Jenkins and a little modification to the Jenkins’ job. The first thing was to install the plugin which pulled NodeJS down from nodejs.org. I also updated my configuration to install grunt-cli globally as specified in Grunt’s getting started guide.
After NodeJS is setup and grunt-cli is installed, all that is needed is to configure the Jenkins job to use it. The first task is to add NodeJS and its global packages to the build path for the job. The plugin adds a nifty UI element for this. Just check the box and select which NodeJS installation you want to use. The final task is setting up the commands to install the npm packages and run Grunt. In my configuration I perform the following tasks: update npm, run Grunt, run Composer and finally execute my unit tests.
Doing all this takes about 10 minutes from start to finish. One thing I like about this solution is that it pulls in NodeJS automatically through Jenkins. Another option would be to install NodeJS on the build server and manage it through traditional means (apt-get, dpkg, etc). I like having Jenkins manage this instead but both solutions work well.