Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
Merged
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
15 changes: 14 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class LESSCompiler {
delete this.config.cssModules;
}

getDependencies(file) {
// Get dependencies from file
_deps(file) {
return new Promise((resolve, reject) => {
progeny({rootPath: this.rootPath})(file.path, file.data, (err, deps) => {
if (!err) {
Expand All @@ -44,6 +45,18 @@ class LESSCompiler {
});
}

// If old API is used, then invoke callback
// It's needed, because older Brunch doesn't promisify this method
// Otherwise, just return a promise
getDependencies(data, path, cb) {
if (path && cb) {
return this._deps({data, path})
.then(deps => cb(null, deps))
.catch(err => cb(err));
}
return this._deps(data);
}

compile(file) {
const data = file.data;
const path = file.path;
Expand Down