Minify HTML output #47

wants to merge 2 commits into


None yet
4 participants

ofnof commented Apr 24, 2012

No description provided.

Martijn van der Heijden Minify HTML output 9c107c4

kvakes commented Apr 26, 2012

Interesting feature. How do I turn it on/off? Actually, I'm thinking that we only need to minify in production, right? How do we do that?


ofnof commented Apr 26, 2012

At the moment you can't turn it off.

I think that the definition of production mode in Stacey is flexible. A page request is parsed through different systems to make it a production ready page and you might see the minifier as just another step in the parser chain. If I am correct the JSON minifier also does not have an option to turn it on/off.

But of course your comment is valid. And maybe we can make a "bypass_minifier" variable just like we have a "bypass_cache". What do you think? Or should we see it as just another step in the parsing process and leave the output like it is?


kvakes commented Apr 29, 2012

I think we spend most of the time reading the code, thus we need it as-is. And minification only matters in production, really. And, as you see, this feature throws other problems on us: now we need to have info about environment (dev vs production).

My opinion is that Stacey simplifies development of small websites a lot. But this feature aims to optimize something that don't need to be optimized. I mean, we have caching, right? And how many bytes you're going to save?

I see this feature as pro-optimizing for huge websites.

Martijn van der Heijden Make minify process a setting
Minifying is now off by default. It can be turned on for all pages by
adding 'minify: true' to _shared.yml. Or it can be turned on for an
individual page by adding 'minify: true' to the page variables.

ofnof commented Apr 30, 2012

What do you think of the changes that I've made based on your input?
Minifying is now off by default. It can be turned on for all pages by adding 'minify: true' to _shared.yml. Or it can be turned on for an individual page by adding 'minify: true' to the page variables.


kvakes commented Jun 8, 2012

I don't think it's a very good idea. Yes, FB, Google and Reddit minify HTML output. But even YouTube and Wikipedia don't do that. And man they're huge. Seems that it just does not worth it.

I think we all need to focus on project's goals, which are, as far as I know, make a framework that is 1) works right out of the box, 2) can be easily hacked and extended.

Wouldn't just the cache file need to be minified? There kind of is a separation of the development platform (.yml files and templates), from the production pages (each page in cache) If anyone out there has never opened a cache file, it is just an html page, you should check it out.

I kind of agree that minifying may not be super helpful to most people though. I did a quick test and my cache page went from 23.3kb to 20.1kb. I don't think it would help my users.

I think a feature I would like to see is a modification of Stacey that could output your site to a directory structure that was just just straight html, with no php at all. That would be the most optimized site possible. I don't understand fully how the caching system works though, maybe it is really close to being this efficient.

minifying html does not help much, especially since proper html compression should be handled by GZIP anyway. Just for reference, you can also use TWIG {% spaceless %} content here {% endspaceless %} in your templates, which will basically minify the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment