Grunt Plugin Install
Steps to Follow
Step 1: Go to Grunt Contrib Website
Go to the Grunt Contrib website to view the list of available plugin options. Select one and click on the link to go to the specific plugin page.
Step 2: Run the Install Command
Navigate down the page to the Get Started heading and observe the command to intall the plugin as seen below.
Open a command window within the repository /trunk. Type the same command as seen in the Get Started plugin page and hit Enter. Wait for all the files to finish downloading. Once the files have completed downloading, proceed to the next step.
Step 3: Verify the Install
Use the folder explore window and navigate to the repository /trunk. You should see the package.json file has been updated as seen below.
Open the package.json file and you should see a new entry for the plugin just installed as seen below. Once verified, close the file and commit the update package.json to the SVN repository.
Step 4: Update the Grunt.js File
Open the Gruntfile.js file that can be found in the same location as the package.json file. Go to approximately line 38 of the file and you should see all the plugins that have previously been configured. Add the downloaded plugin in alphabetical order as seen below.
Next, go to approximately line 53 in the Gruntfile.js file as seen below. Using the same name as in the previous step, add the downloaded plugin as a task in the desired build process. In this example, the plugin was added to the test build process. Once the plugin has been added to the desired build process of processes, Save and Close the Grunt.js file. Next, Commit the Grunt.js file to the SVN repository.
Step 5: Create the Task JS File
Navigate inside the /tasks directory and you should a list of other existing task js files as seen below. Create a task js file by copying an existing file and rename it using the same naming convention as used in the Grunt file. The only exeption will be that since this is a file, the .js file extention will need to be preserved. In this example, the file was named qunit.js as seen below.
Next, update the task js file using the code snippet convention as seen below. Other examples can be seen by openning other task js files as needed. Once the task js file is updated, Save and Close the file. As a final step, perform a SVN Add then Commit to the new task js file that was created and the process is complete.
Step 6: Test the New Plugin
Now that you have completed all the steps above, it is time to test the installed plugin. Depending on how you configured the plugin within the Grunt.js file, the testing will vary based on which build process or processes the task added to.