Another Grunt task: installing Imagemin


I am continuing to add to my grunt task runner process that I started in this post, https://iphonedevlog.wordpress.com/2016/10/31/how-to-use-grunt-to-automate-repetitive-tasks/ (At a minimum, you need to do steps 1-6 on that page.)

In this new article, I’ll add one more processors that I had already listed in the previous article:

d. npm install grunt-contrib-imagemin –save-dev (minimize images to make them faster loading)

I am adding it to the Gruntfile.js file already created in that article. So if you are doing grunt for the first time, you should read that page first — it is an introductory guide for the first-time user. Continue reading

Advertisements

How to use Grunt to automate repetitive tasks


Grunt is a task runner. What that means is that it will open a specified program, perform specified tasks on your files, close the program, move to the next task on the list, then repeat until the end of the list. For each project you might lint (proofread) your css and js files, concatenate all your js files so they’ll load once, minimize your css and js files to make them smaller and load faster, compress your image files so they’ll load faster, and create several sizes of a mobile icon. Grunt can automate this process — you no longer need to do each task manually one by one. In this article, we’ll completely set up grunt on our system and make it run one task for us. I’ll explain how I got each piece of the puzzle so we’ll know how to set up the other tasks. Continue reading