UNPKG

zoro-cli

Version:

https://github.com/vuejs/vue-cli

72 lines (64 loc) 1.91 kB
const args = require('minimist')(process.argv.slice(2)) const cwd = __dirname const cssnano = { preset: [ 'default', { mergeLonghand: false, cssDeclarationSorter: false, }, ], } const pxtorem = { rootValue: 100, propList: [ '*', // do not use '!border*' because we do want to transform border-radius '!border', '!border-width', '!border-left', '!border-right', '!border-top', '!border-bottom', '!border-left-width', '!border-right-width', '!border-top-width', '!border-bottom-width', ], selectorBlackList: [ // If value is string, it checks to see if selector contains the string. // If value is regexp, it checks to see if the selector matches the regexp. /^html$/, ], mediaQuery: false, minPixelValue: 0, } // https://github.com/michael-ciniawsky/postcss-load-config const config = { // do not set `map` here // https://github.com/postcss/postcss-loader/issues/207#issuecomment-301255032 // https://github.com/michael-ciniawsky/postcss-load-config#plugins plugins: { 'postcss-import': { path: [cwd], }, precss: { // disable all unstable features, otherwise will break browserslist // https://github.com/csstools/postcss-preset-env#stage stage: false, autoprefixer: {}, // - postcss-custom-properties is limited to :root selector // - you can use postcss-advanced-variables instead // - https://github.com/postcss/postcss-custom-properties // - https://github.com/jonathantneal/postcss-advanced-variables }, 'postcss-calc': {}, }, } // 一般情况下不需要 cssnano, dev 的时候会被内联到 js 里面, build 会被 webpack 压缩 if (args.min) { config.plugins.cssnano = cssnano } // 如果不需要自动转 rem, 删掉此行和 pxtorem config.plugins['postcss-pxtorem'] = pxtorem module.exports = config