Jay Klehr wrote:
> I'd recommend you think twice about having PHP serve your CSS files, 
> it's unnecessary overhead, and won't scale very well.  I'd suggest 
> looking into a generator solution, where you trigger the css file to be 
> created, so that your webserver can still serve a static CSS file.  Even 
> a caching solution requires PHP to sit on top of the CSS request to 
> determine if it should serve the cached version or generate a new copy.  
> PHP will always be slower than serving a static file, and PHP will 
> always put more load on your machine than serving a static file.

Yes this would be ideal, it would be even better if Symfony could handle 
this for me - write the generated css to the webroot's /css dir so that 
apache can serve it as a regular file and have Symfony remove it on the 
next 'symfony cc'. I've not found any evidence of that being possible 
though, afaik the caching systems works only when requests are routed 
through the framework.

> I don't know your situation, so perhaps there is a good use case for 
> what you're proposing, just be aware of the implications of having all 
> of the Symfony code loaded for at least two requests per pageview (and 
> be sure you set it up so the browser can still cache the CSS, otherwise 
> it'll happen with every pageview.)

I agree about the overhead, but I figured that would only be on the 
first page request as the css would be cached after that. So that would 
mean one extra processing job per visitor. I guess I'd have to do some 
benchmarking to see if it actually has a significant impact.

Thanks for your answer.


cheers,

roel


> Jay
> 
> Roel Vanhout wrote:
>> Hi,
>>
>> I'd like to generate my stylesheets dynamically (so that I can use 
>> variables for colors and use the link_to() helper for image tags in 
>> @url's) but I didn't find anything specific about it in the manual. All 
>> that is really needed is to run the stylesheet template through the 
>> template processor once, but that doesn't seem to be possible. So my 
>> fallback idea was to delete the /css directory from my web root, make a 
>> module called 'css' and have actions in there for every stylesheet I 
>> need (at the moment only one, 'style.css'). I think I would have to 
>> include my stylesheet with a link to /css/style and not /css/style.css, 
>> but I could not find a way to suppress the '.css' that is added 
>> automagically by symfony.
>>
>> Now my actual questions:
>> 1) Is this (i.e., treating stylesheets like all other pages, with an 
>> action and a template) the way to have dynamic stylesheets?
>> 2) How do I stop symfony from adding .css to my stylesheet, or will I 
>> have to use mod_rewrite to re-route /css/style.css to /css/style?
>>
>> Thanks.
>>
>>
>> cheers,
>>
>> roel
>>
>>   
> 
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to