MCPcopy Create free account
hub / github.com/nuxt/icon / mountCSS

Function mountCSS

src/runtime/components/css.ts:131–147  ·  view source on GitHub ↗
(icon: IconifyIcon)

Source from the content-addressed store, hash-verified

129 const selectors = getAllSelectors()
130
131 async function mountCSS(icon: IconifyIcon) {
132 if (selectors.has(selector.value))
133 return
134 if (typeof document === 'undefined')
135 return
136 const style = document.createElement('style')
137 style.textContent = getCSS(icon)
138 if (import.meta.dev) {
139 style.dataset.nuxtIconDev = props.name
140 }
141 const firstStyle = document.head.querySelector('style, link[rel="stylesheet"]')
142 if (firstStyle)
143 document.head.insertBefore(style, firstStyle)
144 else
145 document.head.appendChild(style)
146 selectors.add(selector.value)
147 }
148
149 watch(
150 () => props.name,

Callers 1

setupFunction · 0.85

Calls 1

getCSSFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…