Skip to content

Commit

Permalink
fix(generate): Replace + with \x00 (#10)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This change will result in new names being generated, particularly those using [hash]. You will need to upgrade to css-loader >= 4 if you are wanting to keep the classes in sync.
  • Loading branch information
benmvp committed Oct 24, 2020
1 parent d57cb1c commit 191c17e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = function createGenerator(pattern, options) {
content:
hashPrefix +
path.relative(context, filepath).replace(/\\/g, "/") +
"+" +
"\x00" +
localName,
context: context
};
Expand Down
40 changes: 25 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"tape": "^4.6.2"
},
"dependencies": {
"loader-utils": "^1.1.0"
"loader-utils": "^2.0.0"
}
}
6 changes: 3 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test("use `cwd` if no context was provided", t => {

t.equal(
generate("foo", path.join(__dirname, "test/case/source.css")),
"source__foo___3D34a"
"source__foo___2e6d7"
);
t.end();
});
Expand All @@ -23,7 +23,7 @@ test("generate distinct hash for the provided context", t => {

t.equal(
generate("foo", path.join(__dirname, "test/case/source.css")),
"source__foo___19xFw"
"source__foo___22-0m"
);
t.end();
});
Expand All @@ -36,7 +36,7 @@ test("generate distinct hash for the provided hashPrefix", t => {

t.equal(
generate("foo", path.join(__dirname, "test/case/source.css")),
"source__foo___3T0Un"
"source__foo___1rt0M"
);
t.end();
});

0 comments on commit 191c17e

Please sign in to comment.