diff --git a/.babelrc b/.babelrc index 053e95a..ebb7a71 100644 --- a/.babelrc +++ b/.babelrc @@ -1,10 +1,7 @@ { "presets": [ ["env", { - "modules": false, - "targets": { - "browsers": ["last 2 versions"] - } + "modules": false }] ], "plugins": [ diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..c9c0379 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,12 @@ +last 2 major versions + +# Desktop +# last 3 Chrome major versions +# last 3 Firefox major versions +# last 3 Edge major versions + +# Mobile +# last 3 ChromeAndroid major versions +# last 3 FirefoxAndroid major versions +# last 2 iOS major versions + diff --git a/package-lock.json b/package-lock.json index 5404056..e63163a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1367,7 +1367,7 @@ "dev": true, "requires": { "browserslist": "1.7.7", - "caniuse-db": "1.0.30000751", + "caniuse-db": "1.0.30000760", "lodash.memoize": "4.1.2", "lodash.uniq": "4.5.0" }, @@ -1378,16 +1378,16 @@ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "dev": true, "requires": { - "caniuse-db": "1.0.30000751", + "caniuse-db": "1.0.30000760", "electron-to-chromium": "1.3.27" } } } }, "caniuse-db": { - "version": "1.0.30000751", - "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000751.tgz", - "integrity": "sha1-GRmkC8F+kdh8jAmGlXfGgPnxvv0=", + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000760.tgz", + "integrity": "sha1-PqKUc+t4psywny63Osnh3r/sUo0=", "dev": true }, "caniuse-lite": { @@ -2133,7 +2133,7 @@ "dev": true, "requires": { "browserslist": "1.7.7", - "caniuse-db": "1.0.30000751", + "caniuse-db": "1.0.30000760", "normalize-range": "0.1.2", "num2fraction": "1.2.2", "postcss": "5.2.18", @@ -2152,7 +2152,7 @@ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "dev": true, "requires": { - "caniuse-db": "1.0.30000751", + "caniuse-db": "1.0.30000760", "electron-to-chromium": "1.3.27" } }, @@ -2252,25 +2252,6 @@ } } }, - "csswring": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/csswring/-/csswring-6.0.1.tgz", - "integrity": "sha512-/vMPfuLCk1qnfMDsxXmJWghIj0gSZGAa28XLK7MNxLMxYakROv5uHncdRYgPiRe2SWcXmXM5xfLQ46EBi7u1kQ==", - "dev": true, - "requires": { - "minimist": "1.2.0", - "onecolor": "3.0.4", - "postcss": "6.0.13" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -5012,12 +4993,6 @@ "wrappy": "1.0.2" } }, - "onecolor": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/onecolor/-/onecolor-3.0.4.tgz", - "integrity": "sha1-daRvgNpseqpbTarhekcZi9llJJQ=", - "dev": true - }, "opn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/opn/-/opn-5.1.0.tgz", @@ -6311,7 +6286,7 @@ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "dev": true, "requires": { - "caniuse-db": "1.0.30000751", + "caniuse-db": "1.0.30000760", "electron-to-chromium": "1.3.27" } }, diff --git a/package.json b/package.json index b42a019..3a767ab 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "brfs": "^1.4.3", "clean-webpack-plugin": "^0.1.17", "css-loader": "^0.28.7", - "csswring": "^6.0.1", + "cssnano": "^3.10.0", "expose-loader": "^0.7.3", "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^0.11.2", diff --git a/postcss.config.js b/postcss.config.js index 406f018..4e7a440 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -15,8 +15,8 @@ module.exports = ({file, options, env}) => ({ }, 'postcss-color-function': {}, // 'postcss-strip-inline-comments': {}, - // env === 'production' ? 'autoprefixer')(options.autoprefixer) : false, - 'csswring': options.env === 'production' ? options.csswring : false, + 'autoprefixer': {}, + 'cssnano': options.env === 'production' ? options.cssnano : false, }, }) diff --git a/webpack.common.js b/webpack.common.js index 4310ae0..c5457b6 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -3,7 +3,6 @@ const URL = require('url'); const webpack = require('webpack'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const PJ = require('./package.json') const CRS_PJ = require('crsearch/package.json') @@ -157,7 +156,9 @@ module.exports = env => ({ config: { ctx: { env: env, - csswring: {}, + cssnano: { + autoprefixer: false, + }, }, }, }, @@ -189,8 +190,6 @@ module.exports = env => ({ disable: false, allChunks: true, }), - // new OptimizeCSSAssetsPlugin({ - // }), ] }, }) diff --git a/webpack.prod.js b/webpack.prod.js index 80d4fb5..ce23a2a 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -1,6 +1,7 @@ const common = require('./webpack.common.js'); const webpack = require('webpack'); const CleanWebpackPlugin = require('clean-webpack-plugin'); +const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const Merge = require('webpack-merge'); module.exports = env => (Merge.multiple(common(env), { @@ -17,5 +18,12 @@ module.exports = env => (Merge.multiple(common(env), { }), ], }, + css: { + plugins: [ + new OptimizeCSSAssetsPlugin({ + canPrint: true, + }), + ], + }, }))