HtmlMin icon indicating copy to clipboard operation
HtmlMin copied to clipboard

Only remove comments <!-- -->

Open Pok4 opened this issue 11 months ago • 2 comments

Im using last version and i want if it possible to hide in source code only comments. Now im using

$htmlMin->doOptimizeViaHtmlDomParser(true);               // optimize html via "HtmlDomParser()"
	$htmlMin->doRemoveComments(true);                          // remove default HTML comments (depends on "doOptimizeViaHtmlDomParser(true)")
	$htmlMin->doSumUpWhitespace(false);                        // sum-up extra whitespace from the Dom (depends on "doOptimizeViaHtmlDomParser(true)")
	$htmlMin->doRemoveWhitespaceAroundTags(false);             // remove whitespace around tags (depends on "doOptimizeViaHtmlDomParser(true)")
	$htmlMin->doOptimizeAttributes(false);                     // optimize html attributes (depends on "doOptimizeViaHtmlDomParser(true)")
	$htmlMin->doRemoveHttpPrefixFromAttributes(false);         // remove optional "http:"-prefix from attributes (depends on "doOptimizeAttributes(true)")
	$htmlMin->doRemoveHttpsPrefixFromAttributes(false);        // remove optional "https:"-prefix from attributes (depends on "doOptimizeAttributes(true)")
	$htmlMin->doKeepHttpAndHttpsPrefixOnExternalAttributes(false); // keep "http:"- and "https:"-prefix for all external links 
	$htmlMin->doMakeSameDomainsLinksRelative([]); 				// make some links relative, by removing the domain from attributes
	$htmlMin->doRemoveDefaultAttributes(false);                // remove defaults (depends on "doOptimizeAttributes(true)" | disabled by default)
	$htmlMin->doRemoveDeprecatedAnchorName(false);             // remove deprecated anchor-jump (depends on "doOptimizeAttributes(true)")
	$htmlMin->doRemoveDeprecatedScriptCharsetAttribute(false); // remove deprecated charset-attribute - the browser will use the charset from the HTTP-Header, anyway (depends on "doOptimizeAttributes(true)")
	$htmlMin->doRemoveDeprecatedTypeFromScriptTag(false);      // remove deprecated script-mime-types (depends on "doOptimizeAttributes(true)")
	$htmlMin->doRemoveDeprecatedTypeFromStylesheetLink(false); // remove "type=text/css" for css links (depends on "doOptimizeAttributes(true)")
	$htmlMin->doRemoveDeprecatedTypeFromStyleAndLinkTag(false); // remove "type=text/css" from all links and styles
	$htmlMin->doRemoveDefaultMediaTypeFromStyleAndLinkTag(false); // remove "media="all" from all links and styles
	$htmlMin->doRemoveDefaultTypeFromButton(false);            // remove type="submit" from button tags 
	$htmlMin->doRemoveEmptyAttributes(false);                  // remove some empty attributes (depends on "doOptimizeAttributes(true)")
	$htmlMin->doRemoveValueFromEmptyInput(false);              // remove 'value=""' from empty <input> (depends on "doOptimizeAttributes(true)")
	$htmlMin->doSortCssClassNames(false);                      // sort css-class-names, for better gzip results (depends on "doOptimizeAttributes(true)")
	$htmlMin->doSortHtmlAttributes(false);                     // sort html-attributes, for better gzip results (depends on "doOptimizeAttributes(true)")
	$htmlMin->doRemoveSpacesBetweenTags(false);                // remove more (aggressive) spaces in the dom (disabled by default)
	$htmlMin->doRemoveOmittedQuotes(false);                    // remove quotes e.g. class="lall" => class=lall
	$htmlMin->doRemoveOmittedHtmlTags(false);				   // remove ommitted html tags e.g. <p>lall</p> => <p>lall 

but this configuration has make changes to source code, not hiding only comments. I want to not touch the source code, only hide comments. If this is possible ? Thanks...

Pok4 avatar Dec 18 '24 09:12 Pok4

anyone?

Pok4 avatar Apr 29 '25 16:04 Pok4

up

Pok4 avatar Jun 20 '25 15:06 Pok4