Skip to content

Commit

Permalink
fix(plugins): inserted script should be in head, not after
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Jul 21, 2024
1 parent 9a42e4c commit e098459
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/funny-badgers-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"stein-plugin-tailwindcss": patch
"stein-plugin-unocss": patch
---

Injected script should be before </head>, not after.
2 changes: 1 addition & 1 deletion plugins/tailwindcss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default definePlugin<Config>(() => {
}),

transformIndexHtml (html) {
const endHead = html.indexOf("</head>") + "</head>".length;
const endHead = html.indexOf("</head>");
return html.slice(0, endHead) + `<script src="${TW_INJECT_ID}" type="module"></script>` + html.slice(endHead);
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/unocss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default definePlugin<Partial<Config>>((userConfiguration) => {
},

transformIndexHtml (html) {
const endHead = html.indexOf("</head>") + "</head>".length;
const endHead = html.indexOf("</head>");
return html.slice(0, endHead) + `<script src="${UNO_INJECT_ID}" type="module"></script>` + html.slice(endHead);
}
}
Expand Down

0 comments on commit e098459

Please sign in to comment.