Skip to content

Commit

Permalink
fix: 🐛 fix small issues with strings
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDutchCoder committed May 7, 2021
1 parent adf7e78 commit d08f6cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function VitePluginAddScripts (scripts: Script[]): Plugin {
console.error(`"script.position: ${script.position}" is not a valid position. Should be one of [${positions.join(', ')}]`)
}

if (!!script.content) {
if (script.content.length === 0) {
console.error(`"script.content" can't be empty`)
}

Expand All @@ -37,14 +37,14 @@ export default function VitePluginAddScripts (scripts: Script[]): Plugin {
})

// Add all scripts
html.replace(
html = html.replace(
/<\/head>/,
`${headScripts.join('\n')}</head>`
`${headScripts.join('\n')}\n</head>`
)

html.replace(
html = html.replace(
/<\/body>/,
`${bodyScripts.join('\n')}</body>`
`${bodyScripts.join('\n')}\n</body>`
)

return html
Expand Down

0 comments on commit d08f6cd

Please sign in to comment.