• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Best way to include dynamic CSS?

tyteen4a03

Well-known member
#1
What is the best way to include dynamic CSS in pages? I have a CSS file that is constantly changing due to new data and such, and I have cached it in DataRegistry. I want to serve it via css.php but I'm not sure if I want to bother insert the CSS into the template system.
 

tyteen4a03

Well-known member
#5
...implemented as a XF CSS template and called via css.php? The CSS can be cached, so don't use conditions in the CSS templates.
Maybe I should clarify a bit more... I'm using some database-stored data to generate a CSS stylesheet, I'm not sure whether I should write the final stylesheet to a template and <xen:require> the template, or use some hackery to put the CSS in <head> instead.
 

Jake Bunce

XenForo moderator
Staff member
#6
Maybe I should clarify a bit more... I'm using some database-stored data to generate a CSS stylesheet, I'm not sure whether I should write the final stylesheet to a template and <xen:require> the template, or use some hackery to put the CSS in <head> instead.
xen:require inside of the content template is the normal method. Either way results in a CSS resource in the head though, and that can be cached. Hence no conditions in the CSS.