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

Function prependInjectFallback

packages/vite/src/node/plugins/html.ts:1601–1610  ·  view source on GitHub ↗
(html: string, tags: HtmlTagDescriptor[])

Source from the content-addressed store, hash-verified

1599}
1600
1601function prependInjectFallback(html: string, tags: HtmlTagDescriptor[]) {
1602 // prepend to the html tag, append after doctype, or the document start
1603 if (htmlPrependInjectRE.test(html)) {
1604 return html.replace(htmlPrependInjectRE, `$&\n${serializeTags(tags)}`)
1605 }
1606 if (doctypePrependInjectRE.test(html)) {
1607 return html.replace(doctypePrependInjectRE, `$&\n${serializeTags(tags)}`)
1608 }
1609 return serializeTags(tags) + html
1610}
1611
1612const unaryTags = new Set(['link', 'meta', 'base'])
1613

Callers 2

injectToHeadFunction · 0.85
injectToBodyFunction · 0.85

Calls 1

serializeTagsFunction · 0.85

Tested by

no test coverage detected