Fix path resolution

This commit is contained in:
Samuel Elliott 2019-03-17 08:14:52 +00:00
parent 90035c066f
commit 6a38e8ec47
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
1 changed files with 3 additions and 5 deletions

View File

@ -88,18 +88,16 @@ class Comms {
});
const sassImporter = async (context, url, prev) => {
const file = path.resolve(prev, url);
let file = path.resolve(path.dirname(prev), url);
console.log('Importing', file, url, prev, context);
const scss = await FileUtils.readFile(file);
const scss = await FileUtils.readFile(file).catch(err => FileUtils.readFile(file += '.scss'));
const result = await postcss([postcssUrl({url: 'inline', encodeType: 'base64', optimizeSvgEncode: true})])
.process(scss, {from: file, syntax: postcssScss});
console.log('Processed', file, result);
return {contents: result.css};
return {file, contents: result.css};
};
BDIpc.on('bd-compileSass', (event, options) => {