Skip to content
This repository was archived by the owner on Jun 6, 2022. It is now read-only.

Fix bug importing from multiple sources #42

Merged
merged 1 commit into from
Feb 21, 2020
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
8 changes: 8 additions & 0 deletions .tape.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ module.exports = {
expect: 'basic.import.expect.css',
result: 'basic.import.result.css'
},
'basic:import-css-from-multiple-files': {
message: 'supports { importFrom: ["test/empty.css", "test/import-selectors.css"] } usage',
options: {
importFrom: ["test/empty.css", "test/import-selectors.css"]
},
expect: 'basic.import.expect.css',
result: 'basic.import.result.css'
},
'basic:import-css-from-type': {
message: 'supports { importFrom: [ { from: "test/import-selectors.css", type: "css" } ] } usage',
options: {
Expand Down
5 changes: 3 additions & 2 deletions lib/import-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export default function importCustomSelectorsFromSources(sources) {
const type = (opts.type || path.extname(from).slice(1)).toLowerCase();

return { type, from };
}).reduce(async (customSelectors, source) => {
}).reduce(async (customSelectorsPromise, source) => {
const customSelectors = await customSelectorsPromise
const { type, from } = await source;

if (type === 'ast') {
Expand All @@ -101,7 +102,7 @@ export default function importCustomSelectorsFromSources(sources) {
}

return Object.assign(customSelectors, importCustomSelectorsFromObject(await source));
}, {});
}, Promise.resolve({}));
}

/* Helper utilities
Expand Down
Empty file added test/empty.css
Empty file.