Skip to content

Instantly share code, notes, and snippets.

@aurelian
Created January 20, 2011 16:03
Show Gist options
  • Save aurelian/788099 to your computer and use it in GitHub Desktop.
Save aurelian/788099 to your computer and use it in GitHub Desktop.
dumps sass variables
# 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
%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;"}  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment