-
-
Save frnwtr/5647673bb15ca8893642469d3b400cba to your computer and use it in GitHub Desktop.
const WordpressPurgeCSS = { | |
whitelist: [ | |
"rtl", | |
"home", | |
"blog", | |
"archive", | |
"date", | |
"error404", | |
"logged-in", | |
"admin-bar", | |
"no-customize-support", | |
"custom-background", | |
"wp-custom-logo" | |
], | |
whitelistPatterns: [ | |
/^search(-.*)?$/, | |
/^(.*)-template(-.*)?$/, | |
/^(.*)?-?single(-.*)?$/, | |
/^postid-(.*)?$/, | |
/^attachmentid-(.*)?$/, | |
/^attachment(-.*)?$/, | |
/^page(-.*)?$/, | |
/^(post-type-)?archive(-.*)?$/, | |
/^author(-.*)?$/, | |
/^category(-.*)?$/, | |
/^tag(-.*)?$/, | |
/^tax-(.*)?$/, | |
/^term-(.*)?$/, | |
/^(.*)?-?paged(-.*)?$/ | |
] | |
}; |
@adampatterson if this is still a concern I built a similar whitelist for Gutenberg.
Check it out at https://www.npmjs.com/package/purgecss-with-gutenberg
Thanks @bfiessinger, I will try it out. I ended up hunting through the code for a lot of the elements.
Please give me some link from where i get the information where i add this file in theme file or in root file
please tell me where i add this code {
import Purgecss from 'purgecss'
import purgecssWordpress from 'purgecss-with-wordpress'
const purgeCss = new Purgecss({
content: ['/*.html'],
css: ['/*.css'],
whitelist: purgecssWordpress.whitelist,
whitelistPatterns: purgecssWordpress.whitelistPatterns
})
const result = purgecss.purge()
}
how i run this code
please help me?
thanks in advance
I gave this a try and my SASS compiles, but a lot of the Gutenberg/Media alignment is missing, Do you have any suggestions?
I can manually add them I suppose.