How insert value from Ruby in CSS file


Tags: css,ruby-on-rails,ruby,sass

Problem :

I am seeking for method to insert some ruby code in css (sass).

For example i wanna replace setting of background color in my admin area and wrote it in model Setting.find_by_name('ui_background_color').value

How in css (sass) i can replace this value ?



Solution :

The Rails asset pipeline automatically evaluates ERB, if you have the .erb extension. Please see http://guides.rubyonrails.org/asset_pipeline.html#css-and-erb.

You can then inject Ruby by using ERB syntax:

<%= ruby code %> # Evaluate and display result
<% ruby code %> # Silently evaluate

    CSS Howto..

    On scroll up use the animate() and show the div

    how to create an anchor point

    How to use JS to target specific domain html links with CSS classes?

    How the licensed web font is getting rendered?

    How to make controlls for epub using HTML 5,JavaScript and CSS?

    Can you tell me why my webpage displays differently in IE and how to fix it

    How to make gradual colour change when hover with CSS?

    Bootstrap 3: How to code my banner?

    How can I access CSS selectors programmatically? [closed]

    How to change the text color of the clicked row of table with css and jquery

    How to create a button with overlapping Ribbon Shape in CSS?

    How to make both text and image change on rollover via CSS?

    How to add visual indicator of focus for Radio Button for Firefox

    How to change Fancybox preloader image?

    How do i vertically align my form in bootstrap?

    How do I modify the Datatable header style in PF Dynamic Columns?

    How do I use CSS to give a section a background that doesn't scroll with the page?

    How to Implement Resizing in CSS / DOM

    How to apply !important using .css()?

    Using CSS3 how to animate the multiple `background-image` for different view ports

    How to style checkbox using CSS?

    How can I make my numbered scale responsive to scrolling and clicking?

    How to wait for a video background in HTML until it finish and then view the contents of body section?

    How to align a Wordpress navigation bar to the right of a logo?

    How to set select box height in jquery moblie?

    CSS simple menu - how to align?

    How to locate a pointed div element in css

    CSS html : non-standard picture frame: how to imlement with CSS and HTML?

    jquery carousel how to have a gradient on start and ending slides

    IE8 and lower showing background white