Skip to content

Commit 8452bbf

Browse files
author
Andrey Avsenin
committed
feat: add omit attribute spacing option
1 parent 9a3f3a6 commit 8452bbf

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

.changeset/aqxpiowf.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"vite-plugin-solid": minor
3+
---
4+
5+
Add `omitAttributeSpacing` option to `solid.*` config
6+
7+
Exposes the new `omitAttributeSpacing` option from `babel-plugin-jsx-dom-expressions`.
8+
When set to `false`, the compiler emits a space between attributes in template strings
9+
(`<svg width="12" height="13">` instead of `<svg width="12"height="13">`), producing
10+
valid HTML for strict parsers (XML-based renderers, game-engine browser-likes, etc.).
11+
Defaults to `true` to preserve existing behavior.

src/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,25 @@ export interface Options {
105105
*/
106106
omitQuotes?: boolean;
107107

108+
/**
109+
* When `true` (the default), the generated template output drops the
110+
* whitespace between a quoted attribute and the next attribute
111+
* (`<svg width="12"height="13">`). This preserves upstream behavior and
112+
* relies on the browser's HTML parser to tolerate the missing space.
113+
*
114+
* Set to `false` when targeting strict parsers (e.g. XML/SVG-only or
115+
* game-engine browser-likes such as Coherent Gameface) that reject the
116+
* resulting markup; the output will then contain a regular space between
117+
* attributes (`<svg width="12" height="13">`).
118+
*
119+
* Requires `babel-plugin-jsx-dom-expressions` / `babel-preset-solid`
120+
* versions that understand the `omitAttributeSpacing` option; older
121+
* versions silently ignore the flag.
122+
*
123+
* @default true
124+
*/
125+
omitAttributeSpacing?: boolean;
126+
108127
/**
109128
* The name of the runtime module to import the methods from.
110129
*

0 commit comments

Comments
 (0)