Hello,
I’m trying to implement a batched minification of an array of hashes as stated in the docs. Everything works fine in synchronous mode. But if I set the option returnPromise: true, the returned promise always gets rejected in spite of the minification seems to complete successfully behind the scenes.
let CleanCSS = require('clean-css');
(async () => {
try {
let cleanCSS = new CleanCSS({
batch: true,
returnPromise: true,
});
let outputs = await cleanCSS.minify([
{'path/to/file/one': {styles: 'html { color: #000000; }'}},
{'path/to/file/two': {styles: 'body { background: #ffffff; }'}}
]);
console.log('OK', outputs);
} catch (e) {
console.log('error', e); // <-- always logs: "error" [null, null]
}
})();
Probably, this happens because there is no check for innerErrors === null in the function whenHashBatchDone.
Precheck
Environment
- clean-css version: 5.2.0
- node.js version: 14.17.6
- operating system: any
Configuration options
var CleanCSS = require('clean-css');
new CleanCSS({
batch: true,
returnPromise: true,
});
Demo link for the issue reproduction
clean-css-batch-promise
Hello,
I’m trying to implement a batched minification of an array of hashes as stated in the docs. Everything works fine in synchronous mode. But if I set the option
returnPromise: true, the returned promise always gets rejected in spite of the minification seems to complete successfully behind the scenes.Probably, this happens because there is no check for
innerErrors === nullin the functionwhenHashBatchDone.Precheck
Environment
Configuration options
Demo link for the issue reproduction
clean-css-batch-promise