Skip to content

Instantly share code, notes, and snippets.

@evvvritt
Last active December 20, 2019 15:52
Show Gist options
  • Save evvvritt/9796a508ce7d44dbe19676fd0835b477 to your computer and use it in GitHub Desktop.
Save evvvritt/9796a508ce7d44dbe19676fd0835b477 to your computer and use it in GitHub Desktop.
Simple purgecss implementation for Vue CLI 3
// using in a Vue CLI 3, tailwindcss app but can be adjusted
"scripts": {
"build": "vue-cli-service build",
"postbuild": "yarn purgecss",
"purgecss": "node_modules/purgecss/bin/purgecss --config ./purgecss.config.js --out ./dist/css"
},
// purgecss config - https://www.purgecss.com/configuration
module.exports = {
content: [
'./dist/**/*.html',
'./dist/js/*.js'
],
css: [
'./dist/css/*.css'
],
whitelistPatterns: [
// Modernizr
/touchevents$/,
// Vue transition classes
/-enter-active$/,
/-enter$/,
/-enter-to$/,
/-leave-active$/,
/-leave$/,
/-leave-to$/
]
}
@evvvritt
Copy link
Author

Runs after vue-cli-service build so you don't get the fancy report but should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment