Closed as duplicate of#5292
Closed as duplicate of#5292
Description
Describe the bug
currently if you have a the string of a style tag anywhere in your script tag, you can possibly run into parsing errors because Svelte thinks I'm trying to declare a style tag and I was wondering if it can be fixed without having to cheat around it.
Reproduction
For example
<script lang="ts">
const currentComponentCustomStyles = "h1{background:red}";
const styleTag = `<style type="text/css">${currentComponentCustomStyles}</style>`
</script>
The above code will crash unless you do something like the following
<script lang="ts">
const currentComponentCustomStyles = "h1{background:red}";
const styleTag = "<" + `style type="text/css">${currentComponentCustomStyles}</style>`
</script>
Maybe Svelte's parser can treat the style tag as a simple string if its inside a string or tempalate literals?
Logs
System Info
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-12650H
Memory: 7.60 GB / 15.63 GB
Binaries:
Node: 23.7.0 - C:\Program Files\nodejs\node.EXE
npm: 11.1.0 - C:\Program Files\nodejs\npm.CMD
bun: 1.1.3 - ~\.bun\bin\bun.EXE
Browsers:
Edge: Chromium (129.0.2792.52)
Internet Explorer: 11.0.22621.3527
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels