This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

It would be great if there was an option to minify all html code of the page just like css and js.

it's not really made to do this... but you could wrap your layout between spaceless tags

{% spaceless %}
    <html>
        <!-- page stuff... -->
    </html>
{% endspaceless %}

But keep in mind this won't be true minification, this would just remove the whitespace between tags. So for example

<div>
    <p>
        Hello world
    </p>
</div>

Would be compressed to

<div><p>Hello world</p></div>

Whereas something like...

<div>
    <img
        src="/whatever.jpg"
        alt="Some image">
</div>

would be compressed to

<div><img
        src="/whatever.jpg"
        alt="Some image"></div>

Last updated

Thanks!

or i saw this today on laravel tricks

http://laravel-tricks.com/tricks/minify-html-output

That's definitely a better solution. I'll try it tomorrow.

Hi, Any idea where to paste the Laravel trick in a running app ?

patos said:

Hi, Any idea where to paste the Laravel trick in a running app ?

I know, it's an old post. But has anyone an idea where to place?

See below https://octobercms.com/forum/post/register-twig-extension

Added plugin https://octobercms.com/plugin/dmitrybykov-htmlminify

See also: https://octobercms.com/plugin/xeor-minify

1-10 of 10

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.