Open JulianCataldo opened 2 months ago
I'd rather expose a way to override the minify function with a simple interface, seems like it fits well with the current design of the plugin. Can even be the same option set to a callback instead of a boolean:
pluginOptions.minify = (html) => {
const minifiedHtml = /* process html */
return minifiedHtml;
}
Hello,
I'm willing to open a PR for allowing finer control over HTML minification with
@web/rollup-plugin-html
.Primary motivation for this feature, in my case, is preserving
<!--lit-part EeTSS7FUtCM=-->
comments in Declarative Shadow DOM (from Lit SSR output), thanks to theignoreCustomComments
matcher option.But I'm sure some other peeps will find benefits by exposing the minifier API, versus a simple ON/OFF toggle.
Change:
in: https://github.com/modernweb-dev/web/blob/efd8579cd12d578a742f8f5424ce0bbba36a7e72/packages/rollup-plugin-html/src/output/getOutputHTML.ts#L96-L107
Change:
Association types from
@types/html-minifier-terser
.in:
https://github.com/modernweb-dev/web/blob/efd8579cd12d578a742f8f5424ce0bbba36a7e72/packages/rollup-plugin-html/src/RollupPluginHTMLOptions.ts#L13-L48
What do you think?
Thank you.