Reader small image

You're reading from  Bootstrap 4 Cookbook

Product typeBook
Published inJun 2017
Reading LevelBeginner
PublisherPackt
ISBN-139781785889295
Edition1st Edition
Languages
Right arrow
Author (1)
Ajdin Imsirovic
Ajdin Imsirovic
author image
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses on the subject of web design and web development. He has also authored three books, Bootstrap 4 Cookbook, Elm Web Development, and Vue.js Quick Start Guide. In his fourth book, Vue CLI 3 Quick Start Guide, he introduces readers to the rich ecosystem of frontend tooling and best practices.
Read more about Ajdin Imsirovic

Right arrow

Cleaning up unused CSS with UnCSS and Grunt


In this recipe, we will continue with CSS optimization. In the preceding recipe, we cherry-picked scss partials by simply commenting out those that were not used. For example, we did not use the alert component, so we commented out its Sass @include command in main.scss.

This time, the approach is different. We will use pretty much the same code in our main.scss file in this recipe; however, this time, we will not comment out anything. In other words, we will include all the partials. Then, we'll set up our Grunt task runner with another Grunt plugin, namely, the grunt-uncss plugin. Running the plugin command through our console, we will then take the compiled CSS file and clean it up by removing the unused CSS declarations from it, which will significantly reduce its file size.

Getting ready

To begin with, let's preview the completed recipe. Navigate to chapter9/complete/app/ and run harp server in your console. Next, open your browser and point...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Bootstrap 4 Cookbook
Published in: Jun 2017Publisher: PacktISBN-13: 9781785889295

Author (1)

author image
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses on the subject of web design and web development. He has also authored three books, Bootstrap 4 Cookbook, Elm Web Development, and Vue.js Quick Start Guide. In his fourth book, Vue CLI 3 Quick Start Guide, he introduces readers to the rich ecosystem of frontend tooling and best practices.
Read more about Ajdin Imsirovic