-
-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.bugSomething isn't workingSomething isn't working
Description
Describe the bug
I needed to dynamically define CSS variables based on the config, and I used string interpolation to construct an HTML fragment and insert it at svelte:head. While it works, it confuses the VS Code plugin. First, the branding variable is marked as unused, second there's no type information during interpolation. After some experiments, I found that <style> in the string is what triggering the issue.
Reproduction
<script lang="ts">
const config = { branding: { primaryColor: '#012345' } },
branding = config?.branding;
const cssString = `<style>:root {--primary-color: ${branding?.primaryColor ?? '#ABCDEF'};}</style>`;
</script>
<svelte:head>
{@html cssString}
</svelte:head>
Expected behaviour
I was expecting that string interpolation works regardless the content of the string.
System Info
- OS: [e.g. Windows]
- IDE: [e.g. VSCode, Atom]
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response
pyzenberg
Metadata
Metadata
Assignees
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.bugSomething isn't workingSomething isn't working
