From the course: CSS: Refactoring Style Sheets
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Install and configure Purgecss - CSS Tutorial
From the course: CSS: Refactoring Style Sheets
Install and configure Purgecss
- Remember that daunting challenge of removing all the unused style rules from the bootstrap style sheet? Well I spent an hour trying to clean up that document and I'm still at 85% unused code. Which is not great. The good new is, there's a command line tool specifically designed to solve or at least help with this problem. It's called Purgecss. Now before I show you how to set this up, keep in mind by using this, you're handing control over to a computer for something the computer might not get right. So be very careful, have backups for everything or better yet use version control so you can revert back when Purgecss gets too aggressive. With that warning in mind, lets purge our unused css automatically. Just like with many other tools, Purgecss has its own gulp version and there are versions for other types of task runners as well. You can find all that documentation right here, on the Purgecss site or you see gulp, grunt, rollup and so on. I'm gonna use the gulp-purgecss package…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.