mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 13:39:17 +02:00
Reduced CSS size by 30% using purgecss
This commit is contained in:
parent
5298715427
commit
5128d263e7
4 changed files with 95 additions and 3 deletions
|
@ -1,7 +1,9 @@
|
|||
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const webpack = require('webpack');
|
||||
|
||||
const PurgecssPlugin = require('purgecss-webpack-plugin')
|
||||
const glob = require('glob-all')
|
||||
const path = require('path')
|
||||
let plugins = [
|
||||
// do not include moment.js locales since it's quite heavy
|
||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
||||
|
@ -9,6 +11,16 @@ let plugins = [
|
|||
if (process.env.BUNDLE_ANALYZE === '1') {
|
||||
plugins.push(new BundleAnalyzerPlugin())
|
||||
}
|
||||
plugins.push(
|
||||
new PurgecssPlugin({
|
||||
paths: glob.sync([
|
||||
path.join(__dirname, './public/index.html'),
|
||||
path.join(__dirname, './public/embed.html'),
|
||||
path.join(__dirname, './**/*.vue'),
|
||||
path.join(__dirname, './src/**/*.js')
|
||||
])
|
||||
}),
|
||||
)
|
||||
module.exports = {
|
||||
baseUrl: process.env.BASE_URL || '/front/',
|
||||
productionSourceMap: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue