Make CSS optimization actually work.
gitea/icedream/rekt-theme/master This commit looks good
Details
gitea/icedream/rekt-theme/master This commit looks good
Details
parent
3842b9edd4
commit
a1132e8741
File diff suppressed because one or more lines are too long
|
@ -38,6 +38,7 @@
|
||||||
"case-sensitive-paths-webpack-plugin": "^2.1.2",
|
"case-sensitive-paths-webpack-plugin": "^2.1.2",
|
||||||
"chalk": "^2.4.1",
|
"chalk": "^2.4.1",
|
||||||
"css-loader": "^1.0.0",
|
"css-loader": "^1.0.0",
|
||||||
|
"cssnano": "^4.0.1",
|
||||||
"debug": "^3.1.0",
|
"debug": "^3.1.0",
|
||||||
"eslint": "4",
|
"eslint": "4",
|
||||||
"eslint-config-airbnb-base": "^13.0.0",
|
"eslint-config-airbnb-base": "^13.0.0",
|
||||||
|
@ -53,9 +54,11 @@
|
||||||
"nodemon": "^1.18.1",
|
"nodemon": "^1.18.1",
|
||||||
"normalize-scss": "^7.0.1",
|
"normalize-scss": "^7.0.1",
|
||||||
"npm-run-all": "^4.1.3",
|
"npm-run-all": "^4.1.3",
|
||||||
|
"optimize-css-assets-webpack-plugin": "^4.0.3",
|
||||||
"postcss-import": "^11.1.0",
|
"postcss-import": "^11.1.0",
|
||||||
"postcss-loader": "^2.1.6",
|
"postcss-loader": "^2.1.6",
|
||||||
"postcss-preset-env": "^5.2.1",
|
"postcss-preset-env": "^5.2.1",
|
||||||
|
"postcss-safe-parser": "^3.0.1",
|
||||||
"progress-bar-webpack-plugin": "^1.11.0",
|
"progress-bar-webpack-plugin": "^1.11.0",
|
||||||
"resolve-url-loader": "^2.3.0",
|
"resolve-url-loader": "^2.3.0",
|
||||||
"responsive-loader": "^1.1.0",
|
"responsive-loader": "^1.1.0",
|
||||||
|
@ -76,5 +79,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"typeface-orbitron": "^0.0.54"
|
"typeface-orbitron": "^0.0.54"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"caniuse-api": "3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,18 @@ import { isatty } from 'tty';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import _debug from 'debug';
|
import _debug from 'debug';
|
||||||
// import slash from 'slash';
|
// import slash from 'slash';
|
||||||
|
|
||||||
|
import cssnano from 'cssnano';
|
||||||
|
|
||||||
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
|
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
|
||||||
// import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
// import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
||||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
import HtmlPlugin from 'html-webpack-plugin';
|
import HtmlPlugin from 'html-webpack-plugin';
|
||||||
import ProgressBarPlugin from 'progress-bar-webpack-plugin';
|
import ProgressBarPlugin from 'progress-bar-webpack-plugin';
|
||||||
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
|
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
|
||||||
|
import OptimizeCssAssetsPlugin from 'optimize-css-assets-webpack-plugin';
|
||||||
|
|
||||||
|
import postcssSafeParser from 'postcss-safe-parser';
|
||||||
|
|
||||||
import Environment from './config/webpack/environment';
|
import Environment from './config/webpack/environment';
|
||||||
|
|
||||||
|
@ -263,7 +269,6 @@ export default (options, { mode }) => {
|
||||||
|
|
||||||
// Production builds
|
// Production builds
|
||||||
...[
|
...[
|
||||||
// JavaScript minification
|
|
||||||
new LoaderOptionsPlugin({ debug: false, minimize: true }),
|
new LoaderOptionsPlugin({ debug: false, minimize: true }),
|
||||||
|
|
||||||
// Hoisting
|
// Hoisting
|
||||||
|
@ -319,6 +324,15 @@ export default (options, { mode }) => {
|
||||||
},
|
},
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
}),
|
}),
|
||||||
|
new OptimizeCssAssetsPlugin({
|
||||||
|
assetNameRegExp: /\.css$/gi,
|
||||||
|
cssProcessor: cssnano,
|
||||||
|
cssProcessorOptions: {
|
||||||
|
parser: postcssSafeParser,
|
||||||
|
discardComments: { removeAll: true },
|
||||||
|
},
|
||||||
|
canPrint: true,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
devtool: server ? 'cheap-module-source-map' : 'source-map',
|
devtool: server ? 'cheap-module-source-map' : 'source-map',
|
||||||
|
|
Loading…
Reference in New Issue