-
Notifications
You must be signed in to change notification settings - Fork 136
Closed
Labels
Description
When the importer does not call done synchronously, a nested @import fails.
See sample code below
If you comment out the async invocation and uncomment the direct invocation, things work as expected
import Sass from 'sass.js';
var scssSuccess = '@import "child"; .parent { color:green; }',
scssFail = '.parent { @import "child"; }';
Sass.importer((request, done) => {
var childCss = '.child { color: red; }';
var processContent = (content) => {
var result = {
content: content,
path: 'file:///C:/TMP/child.scss'
};
console.log('importer\n result', result);
done(result);
};
// delayed (async) invocation of done
new Promise(resolve => { resolve(childCss); }).then(processContent);
// direct invocation of done
//processContent(childCss);
});
async function compile(scss) {
return await new Promise(resolve => {
console.log('sass.compile\n content', '>>>' + scss + '<<<');
Sass.compile(scss, resolve);
}).then(function (result) {
console.log('result', result);
return this;
});
}
compile(scssSuccess).
then(() => {
console.log('\n\nFAIL SITUATION');
compile(scssFail);
});