Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Bootstrap 4

You're reading from   Mastering Bootstrap 4 Learn how to build beautiful and highly customizable web interfaces by leveraging the power of Bootstrap 4

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781783981120
Length 286 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Running tasks automatically


Now that we know how to configure and use Grunt to minify our style sheets, let us turn our attention to task automation. That is, how we can execute our Grunt minification task automatically as soon as we make changes to our source files. To this end, we will learn about a second Grunt package, called grunt-contrib-watch (https://github.com/gruntjs/grunt-contrib-watch). As with contrib-css-min , this package can be installed using npm:

npm install grunt-contrib-watch --save-dev

Open package.json and verify that grunt-contrib-watch has been added as a dependency:

    { 
        "name": "MyPhoto", 
        "version": "0.1.0", 
        "devDependencies": { 
            "grunt": "^0.4.5", 
            "grunt-contrib-cssmin": "^0.14.0", 
            "grunt-contrib-watch": "^0.6.1" 
        } 
    } 

Next, tell Grunt about our new package by adding grunt.loadNpmTasks('grunt-contrib-watch'); to Gruntfile.js. Furthermore...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime