Commit f3ccedc8 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[BUGFIX] fix error handling an writing of svg files

parent 487a27aa
......@@ -105,14 +105,18 @@ module.exports = class Css extends Task {
const render = util.promisify(sass.render);
const sourceMapPath = this._getSourceMapsPath(_output);
let compiledSass = await render({
file: _input,
outFile: _output,
outputStyle: 'expanded',
sourceMap: this._config.cssPipeline.sourceMaps,
sourceMapEmbed: false,
precision: 8
});
try {
let compiledSass = await render({
file: _input,
outFile: _output,
outputStyle: 'expanded',
sourceMap: this._config.cssPipeline.sourceMaps,
sourceMapEmbed: false,
precision: 8
});
} catch(_error) {
return this._logger.error(_error.stack);
}
let cssString = this._imageDimensions(compiledSass.css.toString());
......@@ -174,15 +178,18 @@ module.exports = class Css extends Task {
* Creates the inline-svg partial
*/
async _svg() {
const svgPartial = await new InlineSvg(
this._getFullPath(this._config.directories.svg),
{
template: 'sgc-core/inline-svg-template.mustache'
}
);
const partialFilePath = path.join(this._getFullPath(this._config.directories.sass), '_svg.scss');
this._logger.success(`Ẁritten ${chalk.white(path.basename(partialFilePath))}`);
return this._writeFile(partialFilePath, svgPartial);
const svgFolderPath = this._getFullPath(this._config.directories.svg);
if (fs.existsSync(svgFolderPath)) {
const svgPartial = await new InlineSvg(
svgFolderPath,
{
template: 'sgc-core/inline-svg-template.mustache'
}
);
const partialFilePath = path.join(this._getFullPath(this._config.directories.sass), '_svg.scss');
this._logger.success(`Ẁritten ${chalk.white(path.basename(partialFilePath))}`);
this._writeFile(partialFilePath, svgPartial);
}
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment