Skip to content

Commit 4dcaf4d

Browse files
committed
Remove quotes from default processor
1 parent 9651906 commit 4dcaf4d

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,27 @@ import path from "path";
44
import postcss from "postcss";
55
import { replaceSymbols, replaceValueSymbols, extractICSS } from "icss-utils";
66

7+
const readFile = filepath =>
8+
new Promise((resolve, reject) => {
9+
fs.readFile(filepath, "utf-8", (err, content) => {
10+
if (err) {
11+
reject(err);
12+
} else {
13+
resolve(content);
14+
}
15+
});
16+
});
17+
718
const defaultFetch = (importee, importerDir, processor) => {
819
const ext = path.extname(importee);
920
if (ext !== ".css") {
1021
return Promise.resolve({
11-
default: `'${importee}'`
22+
default: importee
1223
});
1324
}
1425
const from = path.resolve(importerDir, importee);
15-
const content = fs.readFileSync(from, "utf-8");
16-
return processor
17-
.process(content, { from })
26+
return readFile(from)
27+
.then(content => processor.process(content, { from }))
1828
.then(result => result.messages.find(d => d.type === "icss").exportTokens);
1929
};
2030

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test("import non-css files as resource", () => {
7272
`)
7373
).resolves.toEqual(
7474
strip(`
75-
.foo { background: url('path/to/resource.png') }
75+
.foo { background: url(path/to/resource.png) }
7676
`)
7777
);
7878
});

0 commit comments

Comments
 (0)