Skip to content

Commit b96b1fb

Browse files
inject css with template string to allow for line breaks (#894)
* inject css with template string to allow for line breaks alternative solution would to be implement a struct `JsStringLiteral` with `fmt::Display` that escapes all forbidden codepoints from the spec https://www.ecma-international.org/ecma-262/#sec-literals-string-literals template string literal seems fine as all browsers that tauri supports have had support for them for the past 3-4+ years Signed-off-by: Chip Reed <chip@chip.sh> * chore(changes) adjust change file Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 6ee720e commit b96b1fb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.changes/load-asset-css.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"tauri": patch
33
---
44

5-
make sure css content injected is inside a string and not injected raw
5+
Make sure CSS content loaded with the `loadAsset` API is inside a template string and not injected raw.

tauri/src/endpoints/asset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn load(
7373
else
7474
css.appendChild(document.createTextNode(content))
7575
document.getElementsByTagName("head")[0].appendChild(css);
76-
}})("{css}")
76+
}})(`{css}`)
7777
"#,
7878
css = asset_str
7979
));

0 commit comments

Comments
 (0)