public
Last active

dumps sass variables

  • Download Gist
controller.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13
# ref: http://bit.ly/fN2ep8
# http://twitpic.com/3rr8dk
def sass_colors
engine= Sass::Engine.new(File.read("app/stylesheets/_colors.scss"), :syntax => :scss, :load_paths => ["app/stylesheets"])
environment= Sass::Environment.new
engine.to_tree.children.each do | node |
next unless node.kind_of? Sass::Tree::VariableNode
node.perform environment
end
 
@sass_vars= environment.instance_variable_get("@vars").reject{|k| k == "important" }
end
sass_colors.html.haml
Haml
1 2 3 4 5 6 7 8 9 10 11
%h2 SASS Colors
 
%table
%tr
%th Variable
%th Color
 
- @sass_vars.each do |var|
%tr
%td= "#{var[0]}: #{var[1]}"
%td{:style => "background-color:#{var[1]};width:80%;height:32px;"}  

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.