Watch This!

What if we didn’t have to run a command at all? I mean, we would have to run grunt every time we wanted to make a change to one of our files before we could test that change on Chrome. What if Grunt could just magically package our extension each time we made a change? Although it’s not exactly magic, Grunt can do exactly that with a plug-in called grunt-contrib-watch. When we downloaded and installed our other plug-ins, we added them to package.json and then ran npm install. This time, we are going to download and install first, and then (automatically) add a new line to package.json. See Listing 4.10.

Listing 4.10 Install grunt-contrib-watch, and Add It to package.json in One Command

sfoote@sfoote-mac:kittenbook ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.