HTML resources delivered by the FIT server can be automatically minified. This reduces the amount of data that has to be transferred to the client, which in turn reduces latency.
For XHTML documents the HTML minifier will be disabled automatically.
By default HTML minifying is disabled. You can enable minifying of HTML markup with the setting in conf/config.xml
:
<config>
<acceleration>
<html-minifying />
</acceleration>
</config>
After enabling the HTML minifier setting in conf/config.xml
all options are enabled by default. In some cases it could be useful to disable single options, e.g. to retain (copyright) comments:
<config>
<acceleration>
<html-minifying comments="false" />
</acceleration>
</config>
Available options are:
textnode-whitespaces
: Reduces multiple whitespace characters to a single blank in text nodes, excepting text nodes in some elements like script
, style
, textarea
or pre
. Be aware that this option may change the layout when the CSS property white-space
is used.comments
: Removes all comments, excepting IE conditional comments (<!--[if ...]>...<!endif]-->
), ko
comments (<!-- ko ...-->...<!-- /ko -->
) and ai-fragment
comments (<!--ai-fragment ...-->...<!--ai-fragment-end-->
).noscript
: Setting this to false
disables the minifying for noscript
elements.class-attribute-whitespaces
: Trims and reduces multiple whitespace characters to a single blank in class
attributesclear-attributes
: Removes some attributes with empty values (e.g. id
, style
or class
), some attributes with default values (e.g. <form method="get">
) and canonizes the boolean attributes
.attribute-quotes
: Removes quotes around the attribute values if the value doesn’t contain special characters like whitespace, quotes or =
.optional-tags
: Removes “optional” closing tags like </html>
, </head>
, </body>
or </tr>
. This option is disabled for PPL requests (assuming the DC property request/ppl
is true
).