-
-
Save ahoward/7c4c282efc4c493ca8caab6ee4e482d3 to your computer and use it in GitHub Desktop.
using sass expressions and all your rails' sass helpers in erb / eruby
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
module ApplicationHelper | |
# <%= sass_eval 'opacify($red, 0.6)' %> | |
def sass_eval(expr) | |
css = ::Sass.compile("#value { value: #{ expr }; }") # ".value {\n value: $sass_processed_arg; }\n" | |
css.split('value:', 2).last.split(';', 2).first.strip | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment