Skip to content

Instantly share code, notes, and snippets.

@LinusBorg
Created March 31, 2019 12:07
Show Gist options
  • Save LinusBorg/44b8de3455c8f3a638c4425f83fb8b12 to your computer and use it in GitHub Desktop.
Save LinusBorg/44b8de3455c8f3a638c4425f83fb8b12 to your computer and use it in GitHub Desktop.
purge css with tailwind and Vue
// Props: https://dev.to/_mikhailbot/vue-cli-3-tailwindcss-and-purgecss-1d1k
const tailwindcss = require('tailwindcss')
const purgecss = require('@fullhuman/postcss-purgecss')
const autoprefixer = require('autoprefixer')
const postcssImport = require('postcss-import')
module.exports = {
plugins: [
postcssImport,
tailwindcss('./tailwind.js'),
purgecss({
content: ['./src/**/*.vue'],
extractors: [
{
extractor: class TailwindExtractor {
static extract(content) {
return content.match(/[A-z0-9-:\/]+/g) || [];
}
},
extensions: ['vue']
}
]
}),
autoprefixer
]
}
@padcom
Copy link

padcom commented Jan 21, 2023

Yeah... the v2 implemented it, then they killed it in v3 so this gist became needed again :) I made it work with the latest version (3.2.x).

https://github.com/padcom/tailwind-example/blob/master/postcss.config.js

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