mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
feat: improve dom application method
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import { Plugin } from "vite";
|
||||
|
||||
export default function shadowDom(): Plugin {
|
||||
return {
|
||||
name: 'merge-css-shadow-dom',
|
||||
enforce: 'post',
|
||||
apply: 'serve',
|
||||
transform(src, id) {
|
||||
if (/\.(css).*$/.test(id)) {
|
||||
const fn =
|
||||
"import { updateStyle, removeStyle } from '@/shadowDomUtils.ts';\n";
|
||||
let updatedSrc = fn + src;
|
||||
updatedSrc = updatedSrc.replace(
|
||||
'__vite__updateStyle(',
|
||||
'updateStyle(',
|
||||
);
|
||||
updatedSrc = updatedSrc.replace(
|
||||
'__vite__removeStyle(',
|
||||
'removeStyle(',
|
||||
);
|
||||
return {
|
||||
code: updatedSrc,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user