-
-
Save jonjaques/d8f18bbdc9f5a1872b4d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def sass_literals(file_path) | |
engine = Sass::Engine.for_file(file_path, {}) | |
environment = Sass::Environment.new | |
keyvals = [] | |
engine.to_tree.children.each do |node| | |
next unless node.kind_of? Sass::Tree::VariableNode | |
if node.expr.kind_of? Sass::Script::Tree::Literal | |
value = node.expr.perform(environment) | |
keyvals.push [node.name, value.to_s] | |
end | |
end | |
return keyvals | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment