Resolve partials properly

This commit is contained in:
Samuel Elliott 2019-03-17 11:00:30 +00:00
parent d4ed8ad240
commit 9a7ec57c18
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
2 changed files with 4 additions and 1 deletions

View File

@ -90,7 +90,10 @@ class Comms {
const sassImporter = async (context, url, prev, inlinedFiles) => {
let file = path.resolve(path.dirname(prev), url);
const scss = await FileUtils.readFile(file).catch(err => FileUtils.readFile(file += '.scss'));
const scss = await FileUtils.readFile(file)
.catch(err => FileUtils.readFile(file += '.scss'))
.catch(err => FileUtils.readFile(file = path.join(path.dirname(file), '_' + path.basename(file).substr(0, path.basename(file).length - 5))))
.catch(err => FileUtils.readFile(file += '.scss'));
const result = await postcss([postcssUrl({url: 'inline', encodeType: 'base64', optimizeSvgEncode: true})])
.process(scss, {from: file, syntax: postcssScss});