mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
ec9724f712
* Add tailwindcss purgecss example * Eslint fixes
32 lines
800 B
JavaScript
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']
|
|
})
|
|
]
|
|
}
|