Open fingers10 opened 3 months ago
Hello, Abdul!
This issue will take some time to research. Most likely, I will have to add an additional property to the CommonHtmlMinificationSettingsBase
class to prevent removing comments like these: <!-- %%-PRERENDERING-BEGIN-%% -->
and <!-- %%-PRERENDERING-END-%% -->
, so that author of the BlazorWasmPreRendering.Build can independently implement this functionality inside his repository.
Hello, Abdul!
In version 2.17.0 a new property was added to HTML and XHTML minification settings - PreservableHtmlCommentList
(default is empty). PreservableHtmlCommentList
property takes a сomma-separated list of string representations of simple regular expressions, that define what HTML comments can not be removed (e.g. "/^\s*saved from url=\(\d+\)/i, /^\/?\$$/, /^[\[\]]$/"
).
Simple regular expressions somewhat similar to the ECMAScript regular expression literals. There are two varieties of the simple regular expressions:
/pattern/
/pattern/i
When implementing integration with the BlazorWasmPreRendering.Build library, you need to use the following settings:
var htmlMinifier = new HtmlMinifier(
new HtmlMinificationSettings()
{
PreservableHtmlCommentList = @"/ %%-PRERENDERING(?:-HEADOUTLET)?-(?:BEGIN|END)-%% /"
}
);
Hi @Taritsyn
Thank you for this wonderful library. I searched the docs and issues and not able to find anything related to Blazor WASM. Does this support Blazor WASM? or can this be combined and used with https://github.com/jsakamoto/BlazorWasmPreRendering.Build which uses build time to prerender blazor wasm projects as HTML and can this be combined with it to Minify the HTML?