Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Requirements::javascriptTemplate for CSS

Go to End

2 Posts   1114 Views


Community Member, 41 Posts

6 January 2011 at 2:25am

Edited: 06/01/2011 2:27am


Is there any method to pass variables to a css file? Requirements::javascriptTemplate makes it for javascript files. In the API there is nothing like Requirements::CSSTemplate.

My aim is to extend the siteconfig with some basic fields like Color1, Color2, Color3 and using variables in the css file like background:color:$SiteConfig.Color1. So that I can build a basic theme editor in the backend and let users change basic styling without touching css files.

Is there anybody who succeeded this?

Thank you for any feedback, help, idea..


Forum Moderator, 5523 Posts

6 January 2011 at 8:51pm

There isn't anything like this. For any projects which I needed complex CSS I've used the compass (sass) module

You could also link via Requirements::css() to be PHP file and include variables in that. An example -