Skip to content

Commit 353b91c

Browse files
committed
Fix addRule for functional values, fix #475
1 parent 56cfb58 commit 353b91c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/utils/toCss.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,20 @@ export default function toCss(selector: string, style: JssStyle, options: Option
4747
}
4848
}
4949

50+
let hasFunctionValue = false
51+
5052
for (const prop in style) {
5153
let value = style[prop]
5254
if (typeof value === 'function') {
5355
value = style[`$${prop}`]
56+
hasFunctionValue = true
5457
}
5558
if (value != null && prop !== 'fallbacks') {
5659
result += `\n${indentStr(`${prop}: ${toCssValue(value)};`, indent)}`
5760
}
5861
}
5962

60-
if (!result) return result
63+
if (!(result || hasFunctionValue)) return result
6164

6265
indent--
6366
result = indentStr(`${selector} {${result}\n`, indent) + indentStr('}', indent)

0 commit comments

Comments
 (0)