Nuxt/examples/tailwindcss-purgecss/postcss.config.js
charlie hield ec9724f712 chore: tailwind purgecss example (#4214)
* Add tailwindcss purgecss example

* Eslint fixes
2018-11-08 10:37:38 +01:00

32 lines
800 B
JavaScript

const path = require('path')
const purgecss = require('@fullhuman/postcss-purgecss')
const tailwindConfig = path.join(__dirname, 'tailwind.js')
class TailwindExtractor {
static extract(content) {
return content.match(/[A-Za-z0-9-_:\/]+/g) || [] // eslint-disable-line no-useless-escape
}
}
module.exports = {
plugins: [
require('tailwindcss')(tailwindConfig),
require('autoprefixer'),
purgecss({
content: [
path.join(__dirname, './pages/**/*.vue'),
path.join(__dirname, './layouts/**/*.vue'),
path.join(__dirname, './components/**/*.vue')
],
extractors: [
{
extractor: TailwindExtractor,
extensions: ['vue', 'js', 'html']
}
],
whitelist: ['html', 'body', 'nuxt-progress']
})
]
}