Kumi
3a30c11ca6
Added `mini-css-extract-plugin`, `css-loader`, and `purgecss-webpack-plugin` to handle CSS extraction and purification in the Webpack build process. Removed the old `purgecss.config.js` as its functionality has been moved to the Webpack configuration. This change aims to streamline the build process and ensure unused CSS is effectively removed, optimizing the final output.
37 lines
No EOL
821 B
JavaScript
37 lines
No EOL
821 B
JavaScript
'use strict'
|
|
|
|
const path = require('path');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const { PurgeCSSPlugin } = require("purgecss-webpack-plugin");
|
|
const glob = require('glob-all');
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
entry: './src/js/main.js',
|
|
output: {
|
|
filename: 'main.js',
|
|
path: path.resolve(__dirname, 'js'),
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.css$/,
|
|
use: [
|
|
MiniCssExtractPlugin.loader,
|
|
'css-loader'
|
|
]
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new MiniCssExtractPlugin({
|
|
filename: '../css/main.css'
|
|
}),
|
|
new PurgeCSSPlugin({
|
|
paths: glob.sync([
|
|
path.join(__dirname, 'index.php')
|
|
]),
|
|
safelist: ['tooltip', 'fade', 'show', 'bs-tooltip-top', 'tooltip-inner', 'tooltip-arrow']
|
|
})
|
|
]
|
|
}; |