chore: optimize CSS imports and PurgeCSS config

Switched to non-minified Bootstrap CSS for improved readability during development. Updated Webpack MiniCssExtractPlugin filename pattern to handle multiple CSS outputs more gracefully. Enhanced PurgeCSSPlugin configuration by incorporating JS paths and limiting removal to specific Bootstrap classes to avoid issues with dynamic class usage.
This commit is contained in:
Kumi 2024-09-04 08:03:45 +02:00
parent ab4e1ad044
commit 035da04bf8
No known key found for this signature in database
GPG Key ID: ECBCC9082395383F
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/js/bootstrap.bundle.min';
import '../css/custom.css';

View File

@ -25,13 +25,15 @@ module.exports = {
},
plugins: [
new MiniCssExtractPlugin({
filename: '../css/main.css'
filename: '../css/[name].css'
}),
new PurgeCSSPlugin({
paths: glob.sync([
path.join(__dirname, 'index.php')
path.join(__dirname, 'index.php'),
path.join(__dirname, 'src/js/**/*.js')
]),
only: ['bootstrap'],
safelist: ['tooltip', 'fade', 'show', 'bs-tooltip-top', 'tooltip-inner', 'tooltip-arrow', 'btn-equals', 'btn-arrow', 'alert', 'alert-warning']
})
]
};
};