Skip to content

Commit c924fba

Browse files
authored
fix: handle boolean css var (#2350)
#2324
1 parent fcc148d commit c924fba

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Attribute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function handleAttribute(
9494
element.addAttribute(name, value);
9595
}
9696
: (name: TransformationArray, value?: TransformationArray) => {
97-
if (attr.name.startsWith('--') && attr.value !== true) {
97+
if (attr.name.startsWith('--')) {
9898
// CSS custom properties are not part of the props
9999
// definition, so wrap them to not get "--xx is invalid prop" errors
100100
name.unshift('...__sveltets_2_cssProp({');

packages/svelte2tsx/test/htmlx2jsx/samples/custom-css-properties/expectedv2.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/svelte2tsx/test/htmlx2jsx/samples/custom-css-properties/input.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
betweenprop
55
--custom-css-property3="hi{jo}hi"
66
--custom-css-property4='hi{jo}hi'
7-
--custom-css-property5=hi{jo}hi />
7+
--custom-css-property5=hi{jo}hi
8+
--custom-css-property6 />

0 commit comments

Comments
 (0)