add build vite plugins
This commit is contained in:
17
packages/vite/src/index.ts
Normal file
17
packages/vite/src/index.ts
Normal 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>`);
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user