Skip to content

Commit

Permalink
fix: remove lib/nib/flex when build and instead by postcss javascript…
Browse files Browse the repository at this point in the history
… api (#54)
  • Loading branch information
lucker committed May 4, 2018
1 parent 1f4a081 commit 60143c8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
10 changes: 7 additions & 3 deletions build/rollup/build-component.rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
})
})
}

Expand Down
1 change: 0 additions & 1 deletion build/stylus-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -218,8 +218,7 @@
"npm": ">= 5.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
"iOS >= 8",
"Android > 4.0"
]
}
3 changes: 2 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -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 }
}
})
1 change: 0 additions & 1 deletion site/docs/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 60143c8

Please sign in to comment.