clean-css-promise
clean-css with the default Promise interface and some improvements
const CleanCssPromise = require('clean-css-promise');
(async () => {
const {styles} = await new CleanCssPromise().minify(`
p {
color: #ff0000;
}
b {
/* nothing */
}
`);
})();
Installation
Use npm.
npm install clean-css-promise
API
const CleanCssPromise = require('clean-css-promise');
class CleanCssPromise([options])
options: Object
(clean-css constructor options)
Almost the same the original clean-css
, except for:
returnPromise
option is enabled by default, and cannot be disabled.- onRejected function receives an
Error
instead of an Array
. - All problems that clean-css considers as warnings, for example broken CSS syntax, are regarded as errors.
const CleanCssPromise = require('clean-css-promise');
new CleanCssPromise({})
.minify('@import url(/foo);}')
.catch(err => {
err.message;
});
License
ISC License © 2017 - 2019 Watanabe Shinnosuke