Skip to content

Commit 8c89899

Browse files
committed
Merge branch 'master' of https://github.com/weexteam/weex-vue-loader into feature-loader
2 parents 4d2f625 + fe06b3c commit 8c89899

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/style-loader.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var styler = require('weex-styler')
22

33
module.exports = function (content) {
44
this.cacheable && this.cacheable()
5-
return 'module.exports = ' + genStyleString(content)
5+
return 'module.exports = ' + genStyleString(content, this)
66
}
77

88
// @todo:
@@ -25,13 +25,22 @@ function convertLength (k, v) {
2525
return v
2626
}
2727

28-
function genStyleString (input) {
28+
function genStyleString (input, loader) {
2929
var output = '{}'
3030
styler.parse(input, function (err, obj) {
3131
if (err) {
3232
return
3333
}
3434
if (obj && obj.jsonStyle) {
35+
if (obj.log) {
36+
obj.log.map((log) => {
37+
if (log.selectors) {
38+
loader.emitWarning(`${log.selectors}: ${log.reason}`)
39+
} else {
40+
loader.emitWarning(`${log.reason}`)
41+
}
42+
})
43+
}
3544
try {
3645
output = JSON.stringify(obj.jsonStyle, convertLength, 2)
3746
.replace(/"([-+]?[0-9]*\.?[0-9]+)CSS_UNIT_([A-Z]+)"/g, '$1 * CSS_UNIT.$2')

0 commit comments

Comments
 (0)