Jump to:

23368 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Requirements::javascriptTemplate for CSS

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

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

Page: 1
Go to End
Author Topic: 752 Views
  • ayyurek
    Avatar
    Community Member
    41 Posts

    Requirements::javascriptTemplate for CSS Link to this post

    Hello,

    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..

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Requirements::javascriptTemplate for CSS Link to this post

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

    You could also link via Requirements::css() to be PHP file and include variables in that. An example - http://davidwalsh.name/css-variables-php-dynamic

    752 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.