Skip to content

Commit

Permalink
fix: className conflict to keyword like constuctor or toString (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
cottom authored and evilebottnawi committed Nov 27, 2018
1 parent 41f5b08 commit cb11e64
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const processor = postcss.plugin('postcss-modules-scope', function(options) {
const generateScopedName =
(options && options.generateScopedName) || processor.generateScopedName;

const exports = {};
const exports = Object.create(null);

function exportScopedName(name) {
const scopedName = generateScopedName(
Expand Down
12 changes: 12 additions & 0 deletions test/test-cases/export-keywords-selector/expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
._input__constructor {
color: green;
}

._input__toString {
color: red;
}

:export {
constructor: _input__constructor;
toString: _input__toString;
}
7 changes: 7 additions & 0 deletions test/test-cases/export-keywords-selector/source.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:local(.constructor) {
color: green;
}

:local(.toString) {
color: red;
}

0 comments on commit cb11e64

Please sign in to comment.