[Zope-dev] Re: ZPT for CSS, anyone?

Tres Seaver tseaver at zope.com
Tue Mar 30 14:31:54 EST 2004


Jamie Heilman wrote:
> Chris Withers wrote:
> 
>>Dylan Jay wrote:
>>
>>>disadvantage that the css is no longer valid once templated. ZPT of course
>>>would be the solution if CSS was XML, but alas :( 
>>
>>I think ZPT is just fine for generating CSS. It coudl do with a plan text 
>>mode, like it has an HTML and XML mode, but apart fro mthat, it rocks :-)
> 
> 
> Stylesheets should always be static documents, a dynamic stylesheet
> defeats browser caching

Not if the dynamism is based on user preferences, and if the 
cache-control headers are set appropriately;  in that case, the browser 
(but not intermediate proxies) will still be able to cache the page.

> and destroys the advantages over just inlining
> all the presentation markup.  If you want to have dynamic style, you
> should use dynamic cascading & inclusion instructions, but the
> stylesheets themselves should remain static.  As such, generating
> style in ZPT is a complete waste of time and effort.  The File object
> is a much better fit.

Overall, I agree with you that stylesheets are best kept static. 
However, consider what happens to cacheability when the URLs of of 
images referenced in a document are relative;  the same problem can 
afflict stylesheets, particularly in a setup where virtual hosting is in 
play.

I strongly favor DTML over ZPT for those cases where you need to 
generate dynamic "plain" text (mail, CSS, Javascript, etc.)  Neither 
will be "transparent" to tools like Dreamweaver, but then again I can't 
imagine *any* markup that would be transparent;  it would pretty much 
have to be embedded in whatever "comment" syntax the underlying language 
defines.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com




More information about the Zope-Dev mailing list