diff --git a/build/rollup/build-component.rollup.js b/build/rollup/build-component.rollup.js index 5065a5af1..8bec3f1d9 100644 --- a/build/rollup/build-component.rollup.js +++ b/build/rollup/build-component.rollup.js @@ -8,6 +8,8 @@ const stylus = require('stylus') const babel = bluebird.promisifyAll(require('babel-core')) const TARGET_LIB_BASE = 'lib' const SRC_BASE = 'components' +const postcss = require('postcss') +const autoprefixer = require('autoprefixer') function babelPluginInsertCssImportForVue ({ types: t }) { function computedSameDirCssPosition(filePath) { @@ -30,16 +32,18 @@ function compileVueStylus (content, cb, compiler, filePath) { stylus(content) .set('filename', filePath) .define('url', stylus.url()) - // .include(path.join(__dirname, 'src/*')) .import(path.join(__dirname, '../../components/_style/mixin/*.styl')) .import(path.join(__dirname, '../../node_modules/nib/lib/nib/vendor')) .import(path.join(__dirname, '../../node_modules/nib/lib/nib/gradients')) - .import(path.join(__dirname, '../../node_modules/nib/lib/nib/flex')) .render((err, css) => { if (err) { throw err } - cb(null, css) + postcss([autoprefixer]) + .process(css) + .then(result => { + cb(null, result.css) + }) }) } diff --git a/build/stylus-mixin.js b/build/stylus-mixin.js index 689392de6..cebc95523 100644 --- a/build/stylus-mixin.js +++ b/build/stylus-mixin.js @@ -4,5 +4,4 @@ module.exports = function useMixin(style) { .import(path.join(__dirname, '../components/_style/mixin/*.styl')) .import(path.join(__dirname, '../node_modules/nib/lib/nib/vendor')) .import(path.join(__dirname, '../node_modules/nib/lib/nib/gradients')) - .import(path.join(__dirname, '../node_modules/nib/lib/nib/flex')) } \ No newline at end of file diff --git a/package.json b/package.json index 514682380..6a819380d 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "@types/prettier": "^1.8.0", "@types/vue": "^2.0.0", "aesir-cli": "^0.0.5", - "autoprefixer": "^7.1.2", + "autoprefixer": "^8.4.1", "avoriaz": "^6.0.1", "babel-core": "^6.22.1", "babel-eslint": "^7.1.1", @@ -218,8 +218,7 @@ "npm": ">= 5.0.0" }, "browserslist": [ - "> 1%", - "last 2 versions", - "not ie <= 8" + "iOS >= 8", + "Android > 4.0" ] } diff --git a/postcss.config.js b/postcss.config.js index 790308bc7..3fa448cfa 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,11 +1,12 @@ // https://github.com/michael-ciniawsky/postcss-load-config - +const browserslist = require('./package.json').browserslist module.exports = (ctx) => ({ plugins: { 'postcss-pxtorem': ctx.env !== 'production' ? { rootValue: 100, propWhiteList: [] } : false, 'postcss-url': {url: 'inline'}, 'cssnano': { zindex: false, mergeIdents: false, discardUnused: false, autoprefixer: false, reduceIdents: false }, + 'autoprefixer': { browsers: browserslist } } }) diff --git a/site/docs/theme.md b/site/docs/theme.md index 91d77dcb0..51112593d 100644 --- a/site/docs/theme.md +++ b/site/docs/theme.md @@ -43,7 +43,6 @@ npm install --save-dev babel-plugin-import stylus stylus-loader css-loader // 建议安装并引入css拓展nib @import '~nib/lib/nib/vendor' @import '~nib/lib/nib/gradients' -@import '~nib/lib/nib/flex' // 覆盖样式变量 color-primary = #1AAD19