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.

Author: dejiolowe

Adédèjì is the founder of Lendsqr, the loan infrastructure fintech powering lenders at scale. Before this, he led Trium Limited, the corporate VC of the Coronation Group, which invested in Woven Finance, Sparkle Bank, Clane, and L1ght, amongst others. He has almost two decades of banking experience, including stints as the Divisional Head of Electronic Banking at Fidelity Bank Plc. He drove the turnaround of the bank’s digital business. He was previously responsible for United Bank for Africa Group’s payment card business across 19 countries. Alongside other industry veterans, he founded Open Banking Nigeria, the nonprofit driving the development and adoption of a common API standard for the Nigerian financial industry. Beyond open APIs, Adédèjì works deeply within the fintech ecosystem; he’s the board chairman at Paystack. Adédèjì is a renowned fintech pundit and has been blogging on technology and payments at since 2001.

Leave a Reply

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