Choosing the correct Code Type makes the compression of your code more safe and effective. Choosing the wrong option may lead to fewer optimizations or errors.
There are 3 main groups,
x/html,
CSS and
JavaScript.
Select
JavaScript when you want to compress just JavaScript code, as it would appear in an external.js file. If your JavaScript code contains PHP, ASP or Smarty server side code then select the respective option. This will allow you to minimize your JavaScript code containing PHP, ASP or Smarty without getting syntax errors, while preserving your server side code intact.
note:
JavaScript code contained between tags is considered x/html with embedded JavaScript code. Select a x/html code type in such case.
Select
CSS when you want to compress just Cascading Style Sheets (CSS) code as it would appear in an external style.css file. To compress your CSS containing PHP, ASP or Smarty code select the respective option.
note:
CSS code contained between tags is considered x/html with embedded CSS code. Select a x/html code type in such case.
Select
x/html for web documents that do not contain server side code, such as static web pages.
Select
x/html + PHP if you want to compress x/html containing PHP code. This will ensure that your PHP code remains intact while your x/html code gets minimized. With this option you can safely minimize the x/html code of a
Wordpress theme, a
Joomla template, a
Drupal template or any other PHP based template. Only the following tags are considered valid open and close tags:
,
=,
and ?>.
Select x/html + ASP if you want to compress x/html containing ASP code. Note that ASP code support is simply limited to preserving anything between <% and %> tags.
Select x/html + Smarty if you want to compress Smarty templates code, or any other template system with similar syntax to smarty. Only the following tags are considered valid open and close tags: { and }, and they can contain any number of nested tags. When reading files using
HTML5 ReadFile API, use the specified
charset encoding to render the characters of the dropped file correctly.
Unfortunately ReadAsText() method does not autodetect the encoding of the files properly, so if you see weird characters appearing in your document, or the text is incomplete, choose an appropriate charset value. Most of the times you'll be good using
ISO-8859-1 or
UTF-8, but depending of the language you use in your documents, that needs to be changed.
How to find out:
You can determine which character encoding a certain file uses by opening that file in your browser. For example using FireFox, drop the file in a new tab. If the file displays the characters correctly, check the menu View / Character Encoding and write down the one that is selected.
If the characters appear wrong in FireFox, try selecting a different Character Encoding in the same menu until you find the one that displays your file correctly.
Compresses smarty templates while preserving
smarty code functionality.
Please note that HTMLCompressor uses a custom lightweight smarty parsing engine, and only "
{" and "
}" tag delimiters are supported. You can also view some
smarty compression examples.
Ignores smarty open / close delimiters if they are surrounded by a whitespace character. A whitespace character after "
{" or a whitespace character before "
}".
For more information read the official smarty documentation about
escaping smarty parsing.
Preserves code between
<% and
%> tags.
Please note that
ASP support is quite basic and limited only to preserving anything between the mentioned tags.
before: