roryashfordbentley / Flexbones

Responsive Wordpress barebones theme
MIT License
8 stars 1 forks source link

PurifyCSS #68

Closed DrizzlyOwl closed 7 years ago

DrizzlyOwl commented 7 years ago

Spent some time looking into this and in my present workflow I've got it reading all of the WP theme PHP files and culling all unused css from my stylesheet.

Worth considering? It has a CLI to use in your package.json

https://github.com/purifycss/purifycss#cli-usage

DrizzlyOwl commented 7 years ago

My configuration in Grunt:

purifycss: {
    options: {
        whitelist: ['.classes-that-i-dont-want-to-erase'],
            minify: true
        },
        target: {
            src: ['**/**.php'],
            css: ['styles.css'],
            dest: 'styles.css'
         }
     },

Maybe this will give you a starting foundation

roryashfordbentley commented 7 years ago

There is already a purify setup 💃 .

In package.json within the tests there is once called tests:css:unused which runs tools/unused-css-rules.js

DrizzlyOwl commented 7 years ago

Boom!!