Last active
November 15, 2016 16:06
-
-
Save manuelmeurer/6399889 to your computer and use it in GitHub Desktop.
Render dynamic CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Display::WidgetsController < ApplicationController | |
def show | |
scss = render_to_string('show', locals: { foo: bar }, formats: :scss) | |
@css = Sass::Engine.new(scss, Compass.sass_engine_options.merge(syntax: :scss)).render | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%style{ type: 'text/css' } | |
= css.chomp.html_safe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div[data-id="<%= foo %>"] { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@manuelmeurer it works, thanks you!