Skip to content

Commit c5eb6d2

Browse files
committed
allow more spacing in from clause
1 parent 12e7d42 commit c5eb6d2

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import postcss from 'postcss';
22

33
const declWhitelist = ['extends'],
44
declFilter = new RegExp(`^(${declWhitelist.join('|')})$`),
5-
matchImports = /^([\w ]+) from (?:"([^"]+)"|'([^']+)')$/;
5+
matchImports = /^([\w\s]+?)\s+from\s+(?:"([^"]+)"|'([^']+)')$/;
66

77
const processor = (css) => {
88
let imports = {};
@@ -14,7 +14,7 @@ const processor = (css) => {
1414
let [/*match*/, symbols, doubleQuotePath, singleQuotePath] = matches;
1515
let path = doubleQuotePath || singleQuotePath;
1616
imports[path] = imports[path] || {};
17-
let tmpSymbols = symbols.split(' ')
17+
let tmpSymbols = symbols.split(/\s+/)
1818
.map(s => {
1919
if(!imports[path][s]) {
2020
imports[path][s] = `__tmp_${s}_${processor.getRandomStr()}`;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:import("path/library.css") {
2+
importName: __tmp_importName_rand0;
3+
importName2: __tmp_importName2_rand1;
4+
}
5+
:local(.exportName) {
6+
extends: __tmp_importName_rand0;
7+
extends: __tmp_importName2_rand1;
8+
extends: __tmp_importName_rand0 __tmp_importName2_rand1;
9+
other: rule;
10+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:local(.exportName) {
2+
extends: importName from "path/library.css";
3+
extends: importName2 from "path/library.css";
4+
extends: importName importName2 from "path/library.css";
5+
other: rule;
6+
}

0 commit comments

Comments
 (0)