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

Function compoundsForSelectors

packages/tailwindcss/src/variants.ts:320–347  ·  view source on GitHub ↗
(selectors: string[])

Source from the content-addressed store, hash-verified

318}
319
320export function compoundsForSelectors(selectors: string[]) {
321 let compounds = Compounds.Never
322
323 for (let sel of selectors) {
324 if (sel[0] === '@') {
325 // Non-conditional at-rules are present so we can't compound
326 if (
327 !sel.startsWith('@media') &&
328 !sel.startsWith('@supports') &&
329 !sel.startsWith('@container')
330 ) {
331 return Compounds.Never
332 }
333
334 compounds |= Compounds.AtRules
335 continue
336 }
337
338 // Pseudo-elements are present so we can't compound
339 if (sel.includes('::')) {
340 return Compounds.Never
341 }
342
343 compounds |= Compounds.StyleRules
344 }
345
346 return compounds
347}
348
349export function createVariants(theme: Theme): Variants {
350 // In the future we may want to support returning a rule here if some complex

Callers 6

variants.test.tsFile · 0.90
parseCssFunction · 0.90
addVariantFunction · 0.90
fromAstMethod · 0.85
compoundsWithMethod · 0.85
staticVariantFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected