<cfsavecontent variable="local.layoutMarkup">
<cfoutput>
<!-- all my layout markup -->
</cfoutput>
</cfsavecontent>
<cfoutput>#myCompressionUtility.compres(local.layoutMarkup)#</cfoutput>function setupView(rc) {
rc.markup = myCompressionUtil.compres(rc.markup);
}--
FW/1 documentation: http://framework-one.github.io
FW/1 source code: http://github.com/framework-one/fw1
FW/1 chat / support: https://gitter.im/framework-one/fw1
FW/1 mailing list: http://groups.google.com/group/framework-one
---
You received this message because you are subscribed to the Google Groups "framework-one" group.
To unsubscribe from this group and stop receiving emails from it, send an email to framework-on...@googlegroups.com.
Visit this group at https://groups.google.com/group/framework-one.
For more options, visit https://groups.google.com/d/optout.
If all your CFCs are script, you won’t get whitespace.
If you CFCs are tag-based, you’ll need output=”false” on all cffunction tags AND all cfcomponent tags – including your Application.cfc file. You certainly should not need to do any explicit whitespace “compression” in your code.
Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org
--
Weird, I swear I replied to this but I don’t see it in my sent email or on the list…
If you’re using tag-based components, you need output=”false” on both cffunction AND cfcomponent tags.
If you’re using script-based components, you will get no whitespace.
You certainly should NOT be trying to programmatically compress / suppress whitespace in your code. You’re just doing it wrong at that point 😊
Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org
From: Brian FitzGerald
Sent: Thursday, January 14, 2016 7:25 PM
To: framework-one
Subject: [framework-one] removing whitespace once and for all
Hey guys, sorry I feel like this on has been discussed before, but I didn't see a clear resolution for me. We all know ColdFusion loves generating whitespace. I have output="false" all over the place and yet I'm still getting a lot of whitespace. Rather than try tracking every bit down, I would rather kill it right before rendering.
--
Oh gee, thanks Google Mail, now I have two near-identical responses in this thread… ☹
... potentially lots of whitespace missed in the calling code
<html>
<head>
... somehow some more stubborn whitespace
</head>
<body>
.... some awesome code and whitespace
<p>hello world</p>
</body>
</html><html><head></head><body>Awesome code</body></html> <!--- compress input ---> <cffunction name="compress" output="false"> <cfargument name="input" required="true"> <cfargument name="tabs" default="true"> <cfargument name="newlines" default="true"> <cfargument name="whitespace" default="true"> <cfargument name="reset" default="false"> <cfset var output = trim(arguments.input)>
<cfif arguments.tabs> <cfset output = output.replaceAll("\t", " ")> </cfif>
<cfif arguments.newlines> <cfset output = output.replaceAll("\r", " ")> <cfset output = output.replaceAll("\n", " ")> </cfif>
<cfif arguments.whitespace> <cfset output = output.replaceAll("(\s)\s+", "$1")> </cfif>
<cfif arguments.reset><cfcontent reset="true"></cfif> <cfreturn replace(output, "> <", "><", "all")> </cffunction>I am dealing w/ a large mix of script and tag based components here. I have output="false" (will double check) but even with that, it doesn't get me to my desired result (below).
To be clear, I'm trying to smash ALL whitespace and deliver my entire page to the browser in one compressed string, so instead of:
Why not handle this at the web serer level instead?
--