Skip to content

Commit

Permalink
Improve the imports regex. Rebuild the project
Browse files Browse the repository at this point in the history
  • Loading branch information
Amphiluke committed Jun 29, 2019
1 parent 6dc05a7 commit c815671
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lessCompileRoots.compileRoots({
}
})
.then(rootEntries => {
console.log("Root files compiled are following:");
console.log("Compiled root files:");
console.log(rootEntries.join("\n"));
})
.catch(reason => {
Expand Down
5 changes: 3 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let flat = Array.prototype.flat ? list => list.flat() : list => [].concat(...lis

async function getImports(entries) {
let commentRE = /\/\*[\s\S]*?\*\/|\/\/\s*@import[^;]+;/g;
let importRE = /(?<=@import[^"']+["']).+?(?=['"]\s*;)/g;
let importRE = /(?<=@import\s[^"']*["']).+?(?=['"]\s*;)/g;
let promises = entries.map(entry =>
readFile(entry)
.then(data => {
Expand Down Expand Up @@ -87,7 +87,8 @@ async function getRoots({pattern, globOptions = {}}) {

async function compileRoots({pattern, lessOptions = {}, globOptions = {}}) {
let rootEntries = await getRoots({pattern, globOptions});
return compile(rootEntries, lessOptions);
await compile(rootEntries, lessOptions);
return rootEntries;
}

exports.compileRoots = compileRoots;
Expand Down
2 changes: 1 addition & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let flat = Array.prototype.flat ? list => list.flat() : list => [].concat(...lis

async function getImports(entries) {
let commentRE = /\/\*[\s\S]*?\*\/|\/\/\s*@import[^;]+;/g;
let importRE = /(?<=@import[^"']+["']).+?(?=['"]\s*;)/g;
let importRE = /(?<=@import\s[^"']*["']).+?(?=['"]\s*;)/g;
let promises = entries.map(entry =>
readFile(entry)
.then(data => {
Expand Down

0 comments on commit c815671

Please sign in to comment.