Skip to content

Only remove comments <!-- --> #104

@Pok4

Description

@Pok4

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions