prettier-plugin-templ-script
Advanced tools
Comparing version
@@ -22,3 +22,3 @@ import prettier from 'prettier'; | ||
const { text } = path.getValue(); | ||
const scriptRegex = /^(\s*)<script([\s\S]*?)>\n([\s\S]*?)<\/script>/gm; | ||
const scriptRegex = /^(\s*)<script([\s\S]*?)>(\n([\s\S]*?))?<\/script>/gm; | ||
const matches = text.matchAll(scriptRegex); | ||
@@ -32,5 +32,6 @@ let transformedText = text; | ||
scriptAttributes, | ||
_, | ||
scriptContent, | ||
] of matches) { | ||
if (!scriptContent.trim()) { | ||
if (!scriptContent?.trim()) { | ||
continue; | ||
@@ -37,0 +38,0 @@ } |
{ | ||
"name": "prettier-plugin-templ-script", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Prettier plugin for `<script>` elements in templ.", | ||
@@ -5,0 +5,0 @@ "repository": { |
3302
0.52%52
1.96%