Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/processCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
var urlItems = [];

function replaceImportsInString(str) {
var tokens = str.split(/(\w+)/);
var tokens = str.split(/(\S+)/);
tokens = tokens.map(function(token) {
var importIndex = imports["$" + token];
if(typeof importIndex === "number") {
Expand Down
27 changes: 27 additions & 0 deletions test/localTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,33 @@ describe("local", function() {
return r;
}())
});
testLocal("composes class with hyphen from module", [
":local(.c1) { composes: c-2 from \"./module\"; b: 1; }",
":local(.c3) { composes: c1; b: 3; }",
":local(.c5) { composes: c-2 c4 from \"./module\"; b: 5; }"
].join("\n"), [
[2, ".test{c: d}", ""],
[1, [
"._c1 { b: 1; }",
"._c3 { b: 3; }",
"._c5 { b: 5; }"
].join("\n"), ""]
], {
c1: "_c1 imported-c-2",
c3: "_c3 _c1 imported-c-2",
c5: "_c5 imported-c-2 imported-c4"
}, "?localIdentName=_[local]", {
"./module": (function() {
var r = [
[2, ".test{c: d}", ""]
];
r.locals = {
"c-2": "imported-c-2",
c4: "imported-c4"
};
return r;
}())
});
testLocal("composes class from module with import", [
"@import url(\"module\");",
":local(.c1) { composes: c2 c3 from \"./module\"; composes: c4 from \"./module\"; b: 1; }"
Expand Down