Skip to content

Commit

Permalink
Make it possible to have script/style without newline
Browse files Browse the repository at this point in the history
If the content of a script/style tag is completely empty (no whitespace), don't add a hardline anymore.
Fixes sveltejs#87
  • Loading branch information
Simon Holthausen committed Jan 4, 2021
1 parent 16169cd commit 35ee647
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ function embedTag(
isNodeSupportedLanguage(node) && !isIgnoreDirective(previousComment)
? content.trim() !== ''
? formatBodyContent(content)
: content === ''
? ''
: hardline
: preformattedBody(content);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script context="module"></script>

<script> </script>

<style>

</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script context="module"></script>

<script>
</script>

<style>
</style>

0 comments on commit 35ee647

Please sign in to comment.