Skip to content

Commit

Permalink
fix: ignore custom property set (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Feb 20, 2019
1 parent 53bd7f1 commit b6401e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ const processor = postcss.plugin('postcss-modules-scope', function(options) {

// Find any :local classes
css.walkRules(rule => {
if (
rule.nodes &&
rule.selector.slice(0, 2) === '--' &&
rule.selector.slice(-1) === ':'
) {
// ignore custom property set
return;
}

let parsedSelector = selectorParser().astSync(rule);

rule.selector = traverseNode(parsedSelector.clone()).toString();
Expand Down
6 changes: 6 additions & 0 deletions test/test-cases/ignore-custom-property-set/expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:root {
--title-align: center;
--sr-only: {
position: absolute;
}
}
6 changes: 6 additions & 0 deletions test/test-cases/ignore-custom-property-set/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:root {
--title-align: center;
--sr-only: {
position: absolute;
}
}

0 comments on commit b6401e7

Please sign in to comment.