Last active
May 7, 2021 02:04
-
-
Save frnwtr/5647673bb15ca8893642469d3b400cba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(-.*)?$/ | |
] | |
}; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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