Hi, some cool new tag here: <cms:trim />.
EDIT: Also read new posts below for adding new functionality for stripping off HTML comments and PHP-like comments. More details also given below about enabling automatic minify for all code generated by CouchCMS.
New tag <cms:trim /> can normalize white-spaces, removing double spaces and trimming space-like characters (new lines, tabs, etc) from both ends of the string passed to it.
I got inspiration to make up this tag after reading an article here http://pageconfig.com/post/remove-undes ... im_all-php
CouchCMS 2.0+ has some part of this enabled by default with removing only spaces caused by tags (not exactly the same implementation). So <cms:trim /> can extend this to a greater level.
For all Couch versions <cms:trim /> is cool for minifying purposes.
Usage: <cms:trim var />
(<cms:show var /> can be safely changed to <cms:trim var />)
For snippets:
Works great and fast.
Hope this helps minify some byte-waste across the planet.
Important tip to use with large sparse chunks, like those, generated by html/css layout, cms:pages etc.: cms:trim works like <cms:show />, so it is possible to do this thing:
The code above saves whatever into some new variable named page_listing and outputs it minified.
P.S. Welcome with suggestions and mod requests.
EDIT: Also read new posts below for adding new functionality for stripping off HTML comments and PHP-like comments. More details also given below about enabling automatic minify for all code generated by CouchCMS.
New tag <cms:trim /> can normalize white-spaces, removing double spaces and trimming space-like characters (new lines, tabs, etc) from both ends of the string passed to it.
I got inspiration to make up this tag after reading an article here http://pageconfig.com/post/remove-undes ... im_all-php
CouchCMS 2.0+ has some part of this enabled by default with removing only spaces caused by tags (not exactly the same implementation). So <cms:trim /> can extend this to a greater level.
For all Couch versions <cms:trim /> is cool for minifying purposes.
Usage: <cms:trim var />
(<cms:show var /> can be safely changed to <cms:trim var />)
For snippets:
- Code: Select all
<cms:trim "<cms:embed 'snippet.html' />" />
Works great and fast.
Hope this helps minify some byte-waste across the planet.

Important tip to use with large sparse chunks, like those, generated by html/css layout, cms:pages etc.: cms:trim works like <cms:show />, so it is possible to do this thing:
- Code: Select all
<cms:capture into='page_listing' >
... whatever ...
</cms:capture>
<cms:trim page_listing />
The code above saves whatever into some new variable named page_listing and outputs it minified.
P.S. Welcome with suggestions and mod requests.