Skip to content

Commit a7b740c

Browse files
authored
Merge pull request #21 from pexea12/min-css
feat(webpack): add OptimizeCSSPlugin
2 parents 2048ab5 + 43c7c21 commit a7b740c

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

build/webpack.prod.conf.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const config = require('./webpack.base.conf')
33
const ExtractTextPlugin = require('extract-text-webpack-plugin')
44
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
55
const path = require('path')
6+
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
67

78
config.output.filename = 'vue-image-lightbox.min.js'
89
config.output.libraryTarget = 'umd'
@@ -52,6 +53,14 @@ config.plugins = (config.plugins || []).concat([
5253
}
5354
}),
5455

56+
new OptimizeCSSPlugin({
57+
cssProcessorOptions: {
58+
options: {
59+
safe: true
60+
}
61+
}
62+
}),
63+
5564
new webpack.optimize.OccurrenceOrderPlugin(),
5665
])
5766

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"extract-text-webpack-plugin": "^2.0.0",
4343
"file-loader": "^0.11.1",
4444
"html-webpack-plugin": "^2.28.0",
45-
"optimize-css-assets-webpack-plugin": "^1.3.2",
45+
"optimize-css-assets-webpack-plugin": "^2.0.0",
4646
"rimraf": "^2.6.1",
4747
"style-loader": "^0.13.1",
4848
"uglifyjs-webpack-plugin": "^0.4.3",

yarn.lock

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ cssesc@^0.1.0:
12991299
version "0.1.0"
13001300
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4"
13011301

1302-
"cssnano@>=2.6.1 <4", cssnano@^3.4.0:
1302+
"cssnano@>=2.6.1 <4":
13031303
version "3.10.0"
13041304
resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38"
13051305
dependencies:
@@ -2973,11 +2973,10 @@ [email protected]:
29732973
object-assign "^4.0.1"
29742974
pinkie-promise "^2.0.0"
29752975

2976-
optimize-css-assets-webpack-plugin@^1.3.2:
2977-
version "1.3.2"
2978-
resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-1.3.2.tgz#eb27456e21eefbd8080f31e8368c59684e585a2c"
2976+
optimize-css-assets-webpack-plugin@^2.0.0:
2977+
version "2.0.0"
2978+
resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-2.0.0.tgz#51cae71230ec91a4c157649715e47498e0cb460b"
29792979
dependencies:
2980-
cssnano "^3.4.0"
29812980
underscore "^1.8.3"
29822981
webpack-sources "^0.1.0"
29832982

0 commit comments

Comments
 (0)