Skip to content

Commit 439de28

Browse files
authored
Merge pull request #29 from mpvue/develop
Develop
2 parents dcb95dd + 8458ae4 commit 439de28

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

lib/style-compiler/plugins/scope-id.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ module.exports = postcss.plugin('add-id', function (opts) {
7272
if (/-?animation$/.test(decl.prop)) {
7373
decl.value = decl.value.split(',')
7474
.map(v => {
75-
var vals = v.split(/\s+/)
76-
var name = vals[0]
77-
if (keyframes[name]) {
78-
return [keyframes[name]].concat(vals.slice(1)).join(' ')
75+
var vals = v.trim().split(/\s+/)
76+
var i = vals.findIndex(val => keyframes[val])
77+
if (i !== -1) {
78+
vals.splice(i, 1, keyframes[vals[i]])
79+
return vals.join(' ')
7980
} else {
8081
return v
8182
}

lib/template-compiler/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function (html) {
4040
: compiler.compile
4141

4242
var compiled = compile(html, compilerOptions)
43+
var code
4344

4445
// for mp => *.wxml
4546
compileWxml.call(this, compiled, html)
@@ -51,7 +52,6 @@ module.exports = function (html) {
5152
})
5253
}
5354

54-
var code
5555
if (compiled.errors && compiled.errors.length) {
5656
this.emitError(
5757
`\n Error compiling template:\n${pad(html)}\n` +
@@ -94,6 +94,9 @@ module.exports = function (html) {
9494

9595
this.callback(null, code)
9696
})
97+
.catch(() => {
98+
this.callback(null, code)
99+
})
97100
}
98101

99102
function toFunction (code) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mpvue-loader",
3-
"version": "1.0.14",
3+
"version": "1.0.15",
44
"description": "mpvue single-file component loader for Webpack",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)