makeFile(file) { return new Promise((resolve, reject) => { const srcPath = `${this.srcPath}/${file}.css`; const destPath = `${this.buildPath}/${file}.css`; const input = fs.readFileSync(srcPath, 'utf8'); console.log(colors.yellow(` Bundling CSS file: ${srcPath}`)); postcss() //.use(stylelint) .use(cssimport) .use(cssnext) .use(reporter({ clearMessages: true })) .process(input, { from: srcPath, to: destPath, }) .then((result) => { let text = result.css; if (this.isProduction) { text = new CleanCSS().minify(result.css).styles; } fs.writeFileSync(destPath, text); console.log(colors.green(` CSS bundle created: ${destPath}`)); resolve(); }) .catch((e) => { reject(e); }); }); }