Shrink HTML, CSS and JavaScript
Minify shrinks the document that goes to the browser: superfluous whitespace, comments and empty lines are dropped. If the page cache is active, this already happens when the file is stored, otherwise via an output buffer in the frontend.
The three switches
- In the left sidebar under “Speed” you will find the “Minify” item — that is where the three switches sit one below the other.
- “Minify HTML” removes HTML comments, whereby conditional IE comments are left in place, and shortens the whitespace between tags as well as multiple spaces in the text. Switched on by default.
- “Minify inline CSS” tightens <style> blocks: comments gone, whitespace collapsed, characters around { } : ; , tightened. Switched off by default.
- “Minify inline JS” tightens inline <script> blocks line by line. Switched off by default.
What stays untouched
- External scripts with a src attribute; they contain only the address and no code
- Script blocks with a different type, such as JSON-LD as application/ld+json
- Content in <pre> and <textarea>
- CSS comments that begin with /*!
When the output buffer takes effect
Without the page cache, buffering only happens for GET requests in the frontend; the admin area and feeds are left out. An output is only processed from 255 characters onwards and only if it contains a closing </html>. If all three switches are off, the document stays unchanged.