Closed marksmccann closed 5 years ago
Would something like this work?
async function render(options, callback) {
try {
...
const results = marshalArray(compiled);
if (callback) {
callback(null, results);
}
return results;
} catch(err) {
if (callback) {
callback(err);
}
}
}
That's a great point. So if your setup looks like -
import sass from 'node-sass';
...
sass.render('path/to/file.scss', someCallback);
... and you swap out node-sass-extra
for node-sass
, your callback will never get invoked.
I think your proposal above is solid. It won't break anything if you do nothing but swap the module, but also opens up syntax for async
/await
or the Promise API.
Our async render is not truly a drop-in replacement because the syntax is different; we are returning a promise instead of using a callback. can we support both so that it truly is a drop-in replacement?