MCPcopy
hub / github.com/tailwindlabs/tailwindcss / handler

Function handler

packages/@tailwindcss-vite/src/index.ts:228–249  ·  packages/@tailwindcss-vite/src/index.ts::handler
(src, id)

Source from the content-addressed store, hash-verified

226 },
227 },
228 async handler(src, id) {
229 if (!isPotentialCssRootFile(id)) return
230
231 using I = new Instrumentation()
232 DEBUG && I.start(class="st">'[@tailwindcss/vite] Generate CSS (serve)')
233
234 let roots = rootsByEnv.get(this.environment?.name ?? class="st">'default')
235 let root = roots.get(id)
236 if (!root) {
237 root ??= createRoot(this.environment ?? null, id)
238 roots.set(id, root)
239 }
240
241 let result = await root.generate(src, (file) => this.addWatchFile(file), I)
242 if (!result) {
243 roots.delete(id)
244 return
245 }
246
247 DEBUG && I.end(class="st">'[@tailwindcss/vite] Generate CSS (serve)')
248 return result
249 },
250 },
251
252 hotUpdate({ file, modules, timestamp, server }) {

Callers 1

Calls 9

optimizeFunction · 0.90
isPotentialCssRootFileFunction · 0.85
createRootFunction · 0.85
setMethod · 0.80
generateMethod · 0.80
addWatchFileMethod · 0.80
startMethod · 0.45
getMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected