Skip to content

Commit

Permalink
Merge pull request #4 from argyleink/master
Browse files Browse the repository at this point in the history
fixes #3
  • Loading branch information
dimitrinicolas committed Nov 30, 2022
2 parents ded14e9 + ac917c5 commit 110e026
Show file tree
Hide file tree
Showing 4 changed files with 6,712 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,5 +8,6 @@ logs

.nyc_output
coverage
.coveralls.yml

.vscode
10 changes: 9 additions & 1 deletion index.js
Expand Up @@ -19,6 +19,7 @@ module.exports = (opts = {}) => {
promisesList.push(
new Promise((resolve) => {
const globList = [];
const layer = new Map();

const params = valueParser(rule.params).nodes;

Expand All @@ -33,6 +34,9 @@ module.exports = (opts = {}) => {
path.join(dirName, param.value).replace(/\\/g, '/')
);
}
if (param.type === 'function' && param.value === 'layer') {
layer.set(dirName, param.nodes[0].value);
}
}

if (globList.length) {
Expand All @@ -46,10 +50,14 @@ module.exports = (opts = {}) => {
const sortedEntries = sort(entries)[sorter]();

sortedEntries.forEach((entry) => {
const paramValue = layer.get(dirName)
? `"${entry}" layer(${layer.get(dirName)})`
: `"${entry}"`;

rule.before(
new AtRule({
name: 'import',
params: `"${entry}"`,
params: paramValue,
source: rule.source,
})
);
Expand Down

0 comments on commit 110e026

Please sign in to comment.