ruby on rails - How do I take a string of SCSS and have it output CSS? -
i have templates in application have own style sheets. i'd let users (and myself) take advantage of scss features. however, haven't been able find out how send sass
gem string of scss, , have return regular css.
(i haven't been able find on google, nor easy find in documentation.)
so how do it?
just do:
# scss string str = %q{ $text-color: #555555; $unfocused-background-color: #f1f0ec; body { background: $unfocused-background-color; color: $text-color; } } se = sass::engine.new(str, :syntax => :scss) se.render # => "body {\n background: #f1f0ec;\n color: #555555; }\n"
see sass reference docs here: http://sass-lang.com/docs/yardoc/file.sass_reference.html.
Comments
Post a Comment