Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
let action;
try {
if (!patternlab.isBusy) {
if (_data.file.indexOf('css') > -1 || _data.action === 'refresh') {
action = 'refreshed CSS';
liveServer.refreshCSS();
} else {
action = 'reloaded';
liveServer.reload();
}
resolve(`Server ${action} successfully`);
}
} catch (e) {
reject(`Server reload or refresh failed: ${e}`);
}
});
},