Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/aqxpiowf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"vite-plugin-solid": minor
---

Add `omitAttributeSpacing` option to `solid.*` config

Exposes the new `omitAttributeSpacing` option from `babel-plugin-jsx-dom-expressions`.
When set to `false`, the compiler emits a space between attributes in template strings
(`<svg width="12" height="13">` instead of `<svg width="12"height="13">`), producing
valid HTML for strict parsers (XML-based renderers, game-engine browser-likes, etc.).
Defaults to `true` to preserve existing behavior.
19 changes: 19 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ export interface Options {
*/
omitQuotes?: boolean;

/**
* When `true` (the default), the generated template output drops the
* whitespace between a quoted attribute and the next attribute
* (`<svg width="12"height="13">`). This preserves upstream behavior and
* relies on the browser's HTML parser to tolerate the missing space.
*
* Set to `false` when targeting strict parsers (e.g. XML/SVG-only or
* game-engine browser-likes such as Coherent Gameface) that reject the
* resulting markup; the output will then contain a regular space between
* attributes (`<svg width="12" height="13">`).
*
* Requires `babel-plugin-jsx-dom-expressions` / `babel-preset-solid`
* versions that understand the `omitAttributeSpacing` option; older
* versions silently ignore the flag.
*
* @default true
*/
omitAttributeSpacing?: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an implementation of this option somewhere or is it just not exposed currently

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* The name of the runtime module to import the methods from.
*
Expand Down