weex-vue-precompiler
Advanced tools
Comparing version 0.1.18 to 0.1.19
{ | ||
"name": "weex-vue-precompiler", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"description": "a precompiler for weex-vue-render.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -42,3 +42,3 @@ # weex-vue-precompiler | ||
* `autoprefixer`: options for [autoprefixer](https://github.com/postcss/autoprefixer). default is { browsers: ['> 0.1%', 'ios >= 8', 'not ie < 12'] }. | ||
* `px2rem`: options for [postcss-plugin-px2rem](https://github.com/ant-tool/postcss-plugin-px2rem). default is: { rootValue: 75 }. | ||
* `px2rem`: options for [postcss-plugin-px2rem](https://github.com/ant-tool/postcss-plugin-px2rem). default is: { rootValue: 75 }. (NOTICE: We shouldn't change the value of rootValue here. If you want to change the viewport width, you better use `<meta name="weex-viewport" content="...">` in your html entry file.) | ||
* `aliweex`: boolean. default is false. Tell whether aliweex components are included in your project. | ||
@@ -45,0 +45,0 @@ |
@@ -13,2 +13,23 @@ const identifyTag = require('./identifier') | ||
const mergeStrats = { | ||
px2rem: function (thisConfig, config) { | ||
const { px2rem } = config | ||
const { px2rem: thisPx2rem } = thisConfig | ||
if (px2rem) { | ||
for (k in px2rem) { | ||
if (k === 'rootValue') { | ||
// ignore rootValue. Always use 750. Why? We use meta[name=weex-viewport] and | ||
// meta.setViewport API to set design viewport width, and they would be broken if | ||
// we use other rootValue here. | ||
continue | ||
} | ||
else if (px2rem.hasOwnProperty(k)) { | ||
thisPx2rem[k] = px2rem[k] | ||
} | ||
} | ||
} | ||
return thisPx2rem | ||
} | ||
} | ||
function mergeConfig(thisConfig, config) { | ||
@@ -26,3 +47,3 @@ if (config) { | ||
if (arrayMergeOpts.indexOf(k) <= -1) { | ||
thisConfig[k] = config[k] | ||
thisConfig[k] = mergeStrats[k] ? mergeStrats[k](thisConfig, config): config[k] | ||
} | ||
@@ -29,0 +50,0 @@ } |
47863
1826