[thelist] Design-time and render-time stylesheets

Hassan Schroeder hassan at webtuitive.com
Mon Jul 12 11:08:53 CDT 2004


Mattias Hising wrote:

> We would like to separate styles in at least three different categories 
> design-time to minimize future maintenance and maximize reusability over 
> different webapps. 
/
> Request Time Style sheet
> 1.A single file that is a combination of the 3 sections in the Design 
> Time Style sheet
> <link rel="stylesheet" type="text/css" 
> href="/files/stylesheets/request_time_style.css" />
> 
> Now the fun part! How do we solve this? I have two suggestions but would 
> like to have more suggestions.
> 1.Deploy time. Generate static css-files with installation scripts when 
> webapp is deployed. 1.1 Pros: Style sheet is separated and is reusable 
> and easy to manage. 1.2 Cons: You have to run deploy-scripts and restart 
> the servers when changing/adding style sheets.
> Will generate a huge number of style sheets 

Your Ant script can re-deploy the context -- no need for a server
restart -- and I can't see the number of generated style sheets as
a significant issue. But this would be my second choice.

> 2.Dynamic Style sheet. Generate css-files from request context 
> parameters. style.jsp?theme=green&app=news&mobile=mobile1
> 2.1 Pros:
> Style sheet is separated and is reusable and easy to manage.
> Smaller amount of files than above mentioned solution
> 2.2 Cons:
> Generates load on server
> Will all clients cache dynamic pages?

The latter could be an issue, but if it were me I'd have a style
servlet and use pathinfo for the arguments, so the reference would
be to e.g. 'http://example.com/style/green/news/mobile1'.

Alternatively, you could just use one style sheet name and adjust
the content returned using a Filter (which may be where you're
doing your UA determination, already).

To eliminate file system access, I'd probably try loading all the
"Design Time" style sheets into application variables to give the
style servlet in-memory access to them.

And if server load was an issue, you could always drop back to the
static generation approach. :-)

FWIW!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




More information about the thelist mailing list