Skip to content
This repository was archived by the owner on Oct 2, 2020. It is now read-only.

Add missing arguments to loadFile and loadFileSync #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Fix loadFile error handling in sync mode
When running in sync mode (syncImport option), loadFile should call the
callback instead of returning a promise. This change implements logic
similar to [1].

[1] https://github.com/less/less.js/blob/49cbe520f6b38b4b8797dcba491501c0c461c7f5/lib/less-node/file-manager.js#L31
  • Loading branch information
parshap committed Aug 23, 2017
commit 5fcc7addb65cfeb789c8ab55a8f8b736d7b3501b
5 changes: 5 additions & 0 deletions lib/npm-file-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ module.exports = function(less) {
};

NpmFileManager.prototype.loadFile = function(filename, currentDirectory, options, environment, callback) {
options = options || {};
try {
filename = this.resolve(filename, currentDirectory);
}
catch(e) {
if (options.syncImport) {
callback(e);
return;
}
return new PromiseConstructor(
function(fullfill, reject) {
reject(e);
Expand Down