Skip to content

Commit

Permalink
Add global browserslist support
Browse files Browse the repository at this point in the history
  • Loading branch information
saki7 committed Nov 9, 2017
1 parent 6272092 commit bd89f41
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 44 deletions.
5 changes: 1 addition & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["last 2 versions"]
}
"modules": false
}]
],
"plugins": [
Expand Down
12 changes: 12 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -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

41 changes: 8 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
})

7 changes: 3 additions & 4 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -157,7 +156,9 @@ module.exports = env => ({
config: {
ctx: {
env: env,
csswring: {},
cssnano: {
autoprefixer: false,
},
},
},
},
Expand Down Expand Up @@ -189,8 +190,6 @@ module.exports = env => ({
disable: false,
allChunks: true,
}),
// new OptimizeCSSAssetsPlugin({
// }),
]
},
})
Expand Down
8 changes: 8 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
@@ -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), {
Expand All @@ -17,5 +18,12 @@ module.exports = env => (Merge.multiple(common(env), {
}),
],
},
css: {
plugins: [
new OptimizeCSSAssetsPlugin({
canPrint: true,
}),
],
},
}))

0 comments on commit bd89f41

Please sign in to comment.