UNPKG

@open-wc/rollup-plugin-html

Version:

Plugin for generating an html file with rollup

23 lines (19 loc) 535 B
const htmlMinifier = require('html-minifier-terser'); const defaultMinifyHTMLConfig = { collapseWhitespace: true, removeComments: true, removeRedundantAttributes: true, removeScriptTypeAttributes: true, removeStyleLinkTypeAttributes: true, useShortDoctype: true, minifyCSS: true, minifyJS: true, }; /** * @param {string} htmlString * @param {object} config */ function minifyHtml(htmlString, config = defaultMinifyHTMLConfig) { return htmlMinifier.minify(htmlString, config); } module.exports = { minifyHtml };