refactor: less.render returns promise

isekai-main
Barış Soner Uşaklı 3 years ago
parent 6da3239230
commit 14bc83a88e

@ -7,11 +7,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const childProcess = require('child_process'); const childProcess = require('child_process');
const less = require('less'); const less = require('less');
const util = require('util');
const lessRenderAsync = util.promisify(
(style, opts, cb) => less.render(String(style), opts, cb)
);
const uglify = require('uglify-es'); const uglify = require('uglify-es');
const nconf = require('nconf'); const nconf = require('nconf');
@ -253,7 +249,7 @@ async function compileLess() {
try { try {
const installSrc = path.join(__dirname, '../public/less/install.less'); const installSrc = path.join(__dirname, '../public/less/install.less');
const style = await fs.promises.readFile(installSrc); const style = await fs.promises.readFile(installSrc);
const css = await lessRenderAsync(style, { filename: path.resolve(installSrc) }); const css = await less.render(String(style), { filename: path.resolve(installSrc) });
await fs.promises.writeFile(path.join(__dirname, '../public/installer.css'), css.css); await fs.promises.writeFile(path.join(__dirname, '../public/installer.css'), css.css);
} catch (err) { } catch (err) {
winston.error(`Unable to compile LESS: \n${err.stack}`); winston.error(`Unable to compile LESS: \n${err.stack}`);

Loading…
Cancel
Save