Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
83 views
in Q2A Core by

In qa-theme-base.php you find: 

protected $minifyHtml; // (boolean) whether to indent the HTML

"minify" is for me all code compressed. No indents is "no indents". 

I would rather expect a compression when I see the word "minify". 

Suggestion: Rename $minifyHtml to $noIndentHtml

Q2A version: 1.8.0 beta

1 Answer

0 votes
by
selected by
 
Best answer

Actually the HTML is minified as much as it can be (or close enough anyway). The problem is, with HTML you can't remove space between tags entirely as it changes the behaviour of the HTML.

Simple example:  <b>Hello</b> <i>World</i>
You can't remove the space between those tags because your text will say "HelloWorld" instead of "Hello World".

The best you can do is collapse all space down to one whitespace character, which is exactly what we do (using newline instead of space). If you look at how other systems work you should find they do the same - I know CloudFlare does.

Incidentally, Q2A's minification also has an extra speed benefit because it actually reduces the processing time on the server. In other words, the actual PHP code in qa-theme-base.php is notably faster if indentation is omitted.

by
Thanks for the clarification.
...