-
-
Save jtsagata/810400 to your computer and use it in GitHub Desktop.
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
# 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 | |
visitor = Sass::Tree::Visitors::Perform.new(environment) | |
engine.to_tree.children.each do | node | | |
next unless node.kind_of? Sass::Tree::VariableNode | |
visitor.send(:visit, node) | |
end | |
@sass_vars= environment.instance_variable_get("@vars").reject{|k| k == "important" } | |
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
%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