Skip to content

Commit 8c89d4a

Browse files
committed
reduce parser.js again & fix objectifier.js
1 parent 77b8134 commit 8c89d4a

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

objectifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function process(node, options = {}) {
9191
result[child.selector] = body
9292
}
9393
} else if (child.type === 'decl') {
94-
if (child.startsWith('--')) {
94+
if (child.prop.startsWith('--')) {
9595
name = child.prop
9696
} else if (child.parent && child.parent.selector === ':export') {
9797
name = child.prop

parser.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ function decl(parent, name, value) {
6161
}
6262

6363
if (typeof value === 'number') {
64-
if (value === 0 || UNITLESS[name]) {
65-
value = value.toString()
66-
} else {
67-
value += 'px'
68-
}
64+
value = value.toString()
65+
if (value !== "0" && !UNITLESS[name]) value += 'px'
6966
}
7067

7168
if (IMPORTANT.test(value)) {

0 commit comments

Comments
 (0)