weyusi 2019-05-21 11:16:14 +09:30
parent 37aa7f9758
commit 8531b77cfc
1 changed files with 3 additions and 3 deletions

View File

@ -45,8 +45,8 @@ function logicCss (str, data) {
if (nanomatch.some(path, exclude, { matchBase: true })) return str
}
return new Promise(function (resolve, reject) {
new CleanCSS(options).minify(str, function (err, result) {
return new Promise((resolve, reject) => {
new CleanCSS(options).minify(str, (err, result) => {
if (err) return reject(err)
let saved = ((str.length - result.styles.length) / str.length * 100).toFixed(2)
resolve(result.styles)
@ -107,7 +107,7 @@ function logicSvg () {
assetPath.on('end', () => {
if (assetTxt.length) {
// Minify using svgo
new svgo(options).optimize(assetTxt).then(function (result) {
new svgo(options).optimize(assetTxt).then((result) => {
// Replace the original file with the minified.
route.set(path, result.data)
// Logging