MCPcopy
hub / github.com/vitejs/vite / removeStyle

Function removeStyle

packages/vite/src/client/client.ts:586–601  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

584}
585
586export function removeStyle(id: string): void {
587 if (linkSheetsMap.has(id)) {
588 // re-select elements since HMR can replace links
589 document
590 .querySelectorAll<HTMLLinkElement>(
591 `link[rel="stylesheet"][data-vite-dev-id="${CSS.escape(id)}"]`,
592 )
593 .forEach((el) => el.remove())
594 linkSheetsMap.delete(id)
595 }
596 const style = sheetsMap.get(id)
597 if (style) {
598 document.head.removeChild(style)
599 sheetsMap.delete(id)
600 }
601}
602
603export function createHotContext(ownerPath: string): ViteHotContext {
604 return new HMRContext(hmrClient, ownerPath)

Callers

nothing calls this directly

Calls 3

hasMethod · 0.80
deleteMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected