Last active
January 11, 2024 17:35
-
-
Save anova/313fc451e3385ebc794feaced6111a74 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { PurgeCSSPlugin } = require("purgecss-webpack-plugin"); | |
const glob = require("glob-all"); | |
// https://stackoverflow.com/a/77249323/181295 | |
module.exports = { | |
plugins: [ | |
new PurgeCSSPlugin({ | |
defaultExtractor: (content) => { | |
const defaultSelectors = content.match(/[A-Za-z0-9_-]+/g) || []; | |
const extendedSelectors = content.match(/[^<>"=\s]+/g) || []; | |
return defaultSelectors.concat(extendedSelectors); | |
}, | |
paths: glob.sync([ | |
'./**/*.html', | |
],{ | |
nodir: true | |
}), | |
safelist: { | |
standard: [], | |
keyframes: [], | |
deep: [], | |
greedy: [], | |
} | |
}), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment