<#assign out>
<#compress>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
// Your page here
</BODY>
</HTML>
</#compress>
</#assign>
${out?replace('\n','')}
It assigns the compressed body of the outer assign macro to the variable "out", and the finally writes the value of "out" with all newlines stripped.
The entire page is now a singe line of HTML - a developer's nightmare, but a nice a bandwidth saver.
Combined with Sitemesh, another one of my favorite tools, this is easily and transparently applied to all your pages.
No comments:
Post a Comment