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

Function build

packages/@tailwindcss-browser/src/index.ts:177–206  ·  view source on GitHub ↗
(kind: 'full' | 'incremental')

Source from the content-addressed store, hash-verified

175}
176
177async function build(kind: 'full' | 'incremental') {
178 if (!compiler) return
179
180 // 1. Refresh the known list of classes
181 let newClasses = new Set<string>()
182
183 I.start(`Collect classes`)
184
185 for (let element of document.querySelectorAll('[class]')) {
186 for (let c of element.classList) {
187 if (classes.has(c)) continue
188
189 classes.add(c)
190 newClasses.add(c)
191 }
192 }
193
194 I.end(`Collect classes`, {
195 count: newClasses.size,
196 })
197
198 if (newClasses.size === 0 && kind === 'incremental') return
199
200 // 2. Compile the CSS
201 I.start(`Build utilities`)
202
203 sheet.textContent = compiler.build(Array.from(newClasses))
204
205 I.end(`Build utilities`)
206}
207
208function rebuild(kind: 'full' | 'incremental') {
209 async function run() {

Callers 1

runFunction · 0.70

Calls 4

startMethod · 0.45
hasMethod · 0.45
addMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected