mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
fix(examples): avoid warning with legacy postcss.config.js (#7098)
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
This commit is contained in:
parent
af3cffc3e0
commit
deffd1f4d3
@ -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']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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']
|
||||
})
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user