Fix CSS editor not updating when empty

This commit is contained in:
Samuel Elliott 2018-02-15 19:14:08 +00:00
parent fdb6ddd540
commit c9a20b7fcf
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
2 changed files with 8 additions and 2 deletions

View File

@ -47,6 +47,12 @@ export default class {
if (sendSource)
this.sendToEditor('set-scss', { scss });
if (!scss) {
this._scss = this.css = '';
this.sendToEditor('scss-editor', null);
return Promise.resolve();
}
return new Promise((resolve, reject) => {
this.compile(scss).then(css => {
this.css = css;

View File

@ -73,8 +73,8 @@ class Comms {
});
BDIpc.on('bd-compileSass', o => {
if (!o.args.data && !o.args.path) return;
if (o.args.path && o.args.data) {
if (typeof o.args.path !== 'string' && typeof o.args.data !== 'string') return;
if (typeof o.args.path === 'string' && typeof o.args.data === 'string') {
o.args.data = `${o.args.data} @import '${o.args.path}';`;
o.args.path = undefined;
}