Skip to content

Commit

Permalink
Fix: class splitter should account for prefixed classes
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Mar 18, 2024
1 parent ab547f6 commit f937182
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/plugins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@ export function postcssOptimizeCarbon(
// Ensure that the selector contains a class.
if (selector.includes(".")) {
// Selectors may contain multiple classes, separated by a comma.
const classes = selector
.split(",")
.filter((c) => c.trim().startsWith("."));
const classes = selector.split(",").filter((c) => {
const v = c.trim() ?? "";
// Some Carbon classes may be prefixed with a tag for higher specificity.
// E.g., a.bx--header
const [, rest] = v.split(".");
return Boolean(rest);
});

let remove_rule = true;

Expand Down

0 comments on commit f937182

Please sign in to comment.