Make that css smol
This commit is contained in:
parent
aea6944f16
commit
daf9a20e62
|
@ -1,9 +1,23 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const tailwind = require('tailwindcss');
|
||||||
|
const glob = require('glob-all');
|
||||||
|
|
||||||
const AssetsManifestPlugin = require('webpack-assets-manifest');
|
const AssetsManifestPlugin = require('webpack-assets-manifest');
|
||||||
const CleanPlugin = require('clean-webpack-plugin');
|
const CleanPlugin = require('clean-webpack-plugin');
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
const ShellPlugin = require('webpack-shell-plugin');
|
const ShellPlugin = require('webpack-shell-plugin');
|
||||||
const MinifyPlugin = require('babel-minify-webpack-plugin');
|
const MinifyPlugin = require('babel-minify-webpack-plugin');
|
||||||
|
const PurgeCssPlugin = require('purgecss-webpack-plugin');
|
||||||
|
|
||||||
|
// Custom PurgeCSS extractor for Tailwind that allows special characters in
|
||||||
|
// class names.
|
||||||
|
//
|
||||||
|
// https://github.com/FullHuman/purgecss#extractor
|
||||||
|
class TailwindExtractor {
|
||||||
|
static extract(content) {
|
||||||
|
return content.match(/[A-z0-9-:\/]+/g) || [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
|
@ -28,7 +42,7 @@ module.exports = {
|
||||||
postcss: [
|
postcss: [
|
||||||
require('postcss-import'),
|
require('postcss-import'),
|
||||||
require('postcss-preset-env')({stage: 0}),
|
require('postcss-preset-env')({stage: 0}),
|
||||||
require('tailwindcss')('./tailwind.js'),
|
tailwind('./tailwind.js'),
|
||||||
require('autoprefixer'),
|
require('autoprefixer'),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -49,7 +63,10 @@ module.exports = {
|
||||||
fallback: 'style-loader',
|
fallback: 'style-loader',
|
||||||
use: [{
|
use: [{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
options: {importLoaders: 1},
|
options: {
|
||||||
|
importLoaders: 1,
|
||||||
|
minimize: true,
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
loader: 'postcss-loader',
|
loader: 'postcss-loader',
|
||||||
options: {
|
options: {
|
||||||
|
@ -73,6 +90,18 @@ module.exports = {
|
||||||
extensions: ['*', '.js', '.vue', '.json']
|
extensions: ['*', '.js', '.vue', '.json']
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new PurgeCssPlugin({
|
||||||
|
paths: glob.sync([
|
||||||
|
path.join(__dirname, 'resources/assets/scripts/**/*.vue'),
|
||||||
|
path.join(__dirname, 'resources/themes/pterodactyl/**/*.blade.php'),
|
||||||
|
]),
|
||||||
|
extractors: [
|
||||||
|
{
|
||||||
|
extractor: TailwindExtractor,
|
||||||
|
extensions: ['html', 'js', 'php', 'vue'],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}),
|
||||||
new CleanPlugin(path.resolve(__dirname, 'public/assets')),
|
new CleanPlugin(path.resolve(__dirname, 'public/assets')),
|
||||||
new ShellPlugin({
|
new ShellPlugin({
|
||||||
onBuildStart: [
|
onBuildStart: [
|
||||||
|
|
Loading…
Reference in New Issue