Skip to content

Commit

Permalink
validate @custom-variant selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Jan 29, 2025
1 parent 035101e commit 78f2614
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/tailwindcss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ async function parseCss(
}

let selectors = segment(selector.slice(1, -1), ',')
if (selectors.length === 0 || selectors.some((selector) => selector.trim() === '')) {
throw new Error(
`\`@custom-variant ${name} (${selectors.join(',')})\` selector is invalid.`,
)
}

let atRuleParams: string[] = []
let styleRuleSelectors: string[] = []
Expand Down

0 comments on commit 78f2614

Please sign in to comment.