add build vite plugins

This commit is contained in:
2024-11-04 11:54:37 +08:00
parent 5e67c93b63
commit c5a509e4e8
6 changed files with 179 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
/**
*
* @param isDev
* @param scriptStr <script defer src="https://umami.xiongxiao.me/script.js" data-website-id="aeea5ee5-df79-4e78-8c0d-a9f26db23695"></script>
* @returns
*/
export const unamiPlugin = (scriptStr: string, isDev = false) => {
return {
name: 'html-transform',
transformIndexHtml(html: string) {
if (isDev) {
return html;
}
return html.replace('</head>', `${scriptStr}</head>`);
},
};
};