fix(examples): avoid warning with legacy postcss.config.js (#7098)

Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
This commit is contained in:
Adam 2020-03-24 10:00:39 +01:00 committed by GitHub
parent af3cffc3e0
commit deffd1f4d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 32 deletions

View File

@ -1,3 +1,5 @@
const path = require('path')
export default {
head: {
title: 'Nuxt Tailwind CSS + Purgecss',
@ -12,5 +14,23 @@ export default {
]
},
css: ['~/assets/css/tailwind.css']
css: ['~/assets/css/tailwind.css'],
build: {
postcss: {
plugins: {
tailwindcss: path.join(__dirname, 'tailwind.js'),
autoprefixer: {},
'@fullhuman/postcss-purgecss': {
content: [
path.join(__dirname, './pages/**/*.vue'),
path.join(__dirname, './layouts/**/*.vue'),
path.join(__dirname, './components/**/*.vue')
],
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
whitelist: ['html', 'body', 'nuxt-progress']
}
}
}
}
}

View File

@ -1,31 +0,0 @@
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']
})
]
}