[Seaside] inline or link to styles and scripts

Richard Huxton dev at archonet.com
Tue Jun 13 13:02:08 UTC 2006

Keith Hodges wrote:
> I notice that WAHtmlRoot has methods for (a) rendering style strings 
> into the document, or (2) linkToStyle: url
> Which would be the better approach. Is the browser able to cache 
> imported stylesheets?
> Is it higher performance to send the whole stylesheet inline because 
> there is only one web hit?
> If I try the linkToStyle: approach how do I serve the stylesheet from 
> seaside.

There are two simpler ways of applying styles. You can subclass 
WAStyleLibrary and define a series of methods that return static text 
containing CSS. Then, pick your new style-library class from the 
configuration applicaton. A similar process works for javascript by the way.

Alternatively, in any class that is a subclass of WAComponent you can 
define a method "style" which returns static text containing CSS.

I prefer the first in most cases, but the second can be useful to 
override defaults for specific components.

   Richard Huxton
   Archonet Ltd

More information about the Seaside mailing list