weex-vue-loader
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -244,3 +244,3 @@ // @todo: support hot reload | ||
// output += requireString | ||
output += '__vue_styles__.push(' + requireString + ')' | ||
output += '__vue_styles__.push(' + requireString + ')\n' | ||
}) | ||
@@ -247,0 +247,0 @@ } |
@@ -8,2 +8,22 @@ var styler = require('weex-styler') | ||
// @todo: | ||
// font-relative lengths: em, ex, ch, ic | ||
// viewport-relative lengths: vi, vb | ||
// https://drafts.csswg.org/css-values/#lengths | ||
var REGEXP_LENGTH = /^([-+]?[0-9]*\.?[0-9]+)(rem|vw|vh|vmin|vmax|cm|mm|q|in|pt|pc|px)$/ | ||
function convertLength (k, v) { | ||
if (typeof v !== 'string') { | ||
return v | ||
} | ||
var result = v.match(REGEXP_LENGTH) | ||
if (result) { | ||
if (result[2] === 'px') { | ||
return result[1] | ||
} | ||
return result[1] + 'CSS_UNIT_' + result[2].toUpperCase() | ||
} | ||
return v | ||
} | ||
function genStyleString (input) { | ||
@@ -17,3 +37,4 @@ var output = '{}' | ||
try { | ||
output = JSON.stringify(obj.jsonStyle, null, 2) | ||
output = JSON.stringify(obj.jsonStyle, convertLength, 2) | ||
.replace(/"([-+]?[0-9]*\.?[0-9]+)CSS_UNIT_([A-Z]+)"/g, '$1 * CSS_UNIT.$2') | ||
} catch (e) {} | ||
@@ -20,0 +41,0 @@ } |
{ | ||
"name": "weex-vue-loader", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Vue.js component loader for Webpack", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28343
728