Skip to content

Commit

Permalink
change overwriting
Browse files Browse the repository at this point in the history
  • Loading branch information
mkslanc committed Aug 15, 2023
1 parent 769c858 commit edb237b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/template.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export function generateTemplate(js, html, css) {
if (useCustomUserCode(html)) {
return html.replace("{js}", js).replace("{css}", css);
html+=`<script>${js}</script>`;
html+=`<style>${css}</style>`;
return html;
}
return `<html>
<head>
Expand Down Expand Up @@ -38,5 +40,5 @@ ${html}
}

export function useCustomUserCode(html: string) {
return /<html|<doctype/i.test(html);
return /^\s*(?:<html|<doctype)/i.test(html);
}

0 comments on commit edb237b

Please sign in to comment.