mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
fdc6716df4
* Whitelist nuxt-progress class for progress bar * Fix linting issue
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
const path = require('path')
|
|
const PurgecssPlugin = require('purgecss-webpack-plugin')
|
|
const glob = require('glob-all')
|
|
|
|
class TailwindExtractor {
|
|
static extract(content) {
|
|
return content.match(/[A-z0-9-:/]+/g) || []
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
build: {
|
|
extractCSS: true,
|
|
postcss: [
|
|
require('tailwindcss')('./tailwind.js'),
|
|
require('autoprefixer')
|
|
],
|
|
extend(config, { isDev }) {
|
|
if (!isDev) {
|
|
config.plugins.push(
|
|
new PurgecssPlugin({
|
|
// purgecss configuration
|
|
// https://github.com/FullHuman/purgecss
|
|
paths: glob.sync([
|
|
path.join(__dirname, './pages/**/*.vue'),
|
|
path.join(__dirname, './layouts/**/*.vue')
|
|
]),
|
|
extractors: [
|
|
{
|
|
extractor: TailwindExtractor,
|
|
extensions: ['vue']
|
|
}
|
|
],
|
|
whitelist: ['html', 'body', 'nuxt-progress']
|
|
})
|
|
)
|
|
}
|
|
}
|
|
},
|
|
css: ['~/assets/css/tailwind.css']
|
|
}
|