ColdFusion White Space Reduction

I just finished our new website (my place of work). Now, I live in Nigeria and most of our customers are resident in Nigeria too. However, because of our local Internet infrastructural constraints, most visitors would have narrowband connections.For them to enjoy visiting the website, optimizing code for fast download became imperative. Actually, it was one of the highlight of the new website.

White space has always been one of the issues with ColdFusion application. For enterprise apps, bandwidth is usually not an issue but by the time you want to scale your app across the web to narrowband users, every single count.

While developing the new website (using NWWX CMS), I tried configuring white space management in the CF Admin but it didn’t do much so I hit the internet. I discovered a lot more people had same issue.

Too bad I couldn’t find a pre-cooked strategy so I ended up creating mine. This is what I did.

  • I set <cfsetting enablecfoutputonly=”yes”>
  • Wrapped all my component invocations in <cfsilent>
  • Now, all the index.cfm (a dynamic website with just 1 template and a bunch of components) code is wrapped within a <cfsavecontent variable=”the_web”>
  • Now the fun part. I got a very terribly cool function,  HtmlCompressFormat, from which I rewrote into standard cffunction and included in my library components
  • <cfset html = library.HtmlCompressFormat(the_web,3)>
  • <cfoutput>#html#</cfoutput>

The result was awesome. I got as much as 40% size reduction on some pages and it worked fine. I only had issues with some buttons which were staying too close. I simply added &nbps; to separate them.

If you have other methods, especially something sexier, kindly share.

Discover more from Adédèjì Ọlọ́wẹ̀

Subscribe to get the latest posts to your email.

Author: Adedeji Olowe

Adedeji / a bunch of bananas ate a monkey /

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Adédèjì Ọlọ́wẹ̀

Subscribe now to keep reading and get access to the full archive.

Continue reading