UNPKG

minify

Version:

Minifier of js, css, html and img

27 lines (21 loc) 482 B
import tryToCatch from 'try-to-catch'; import js from './js.js'; import html from './html.js'; import css from './css.js'; import img from './img.js'; const minifiers = [ js, css, html, img, ]; export default async (data, options) => { let error; let result; for (const minify of minifiers) { [error, result] = await tryToCatch(minify, data, options); if (result) return result; } throw error; };