-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Placing Svelte code in an HTML file breaks the document #344
Comments
This isn't a Svelte thing so much as an HTML thing — any occurence of # paste this in to create test HTML file
cat <<EOS > index.html
<script>
if ('</script>') {
console.log('foo')
}
</script>
EOS
# then open it
open index.html ...and you'll see something like this: The traditional workaround is to do something like |
I agree that this is a "flaw", if you will, of HTML. But I'm not running into this issue within a Svelte component, it's happening on the line I highlighted in the Svelte library itself. As far as your minifier comment goes, I'm getting mixed output from different minifiers. All of them concat If you consider this to be too rare of an issue, I can continue to manually replace the line at build. Otherwise, I'm open to either submitting my PR, or discussing other ways to resolve this, and successfully subvert a minifier. |
Ah. I'm not entirely sure I understand, but if it solves your issue and doesn't break anything then please do submit the PR! |
I have to say that it's a very unique use case 😀. Everything appears to work as expected. |
Released as 1.10.3. Thanks again! |
I've run into an issue when using Svelte with webpack (although this issue will more than likely come up in any build environment).
If you place the webpack output into a
<script></script>
block in an HTML file, the document will be broken upon loading.The culprit is one line of code in src/parse/read/script.js line 20.
I have made a commit and I am willing to submit a PR, I just wanted to open an issue to be friendly, and create an open discussion.
Example
Output (in browser)
The text was updated successfully, but these errors were encountered: