Created
March 5, 2010 21:45
-
-
Save unixmonkey/323198 to your computer and use it in GitHub Desktop.
initializer to load a yaml file into sass variables
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
# Throw this in config/initializers and add | |
# @import variables.sass to the top of application.sass | |
# to have all variables in app_config.yml | |
# available as variables in your sass stylesheets | |
sass_variables = [] | |
app_variables = YAML.load_file("#{Rails.root}/config/app_config.yml") | |
app_variables.each do |key, value| | |
sass_vars << "!#{key} = #{value}" | |
end | |
File.open("#{Rails.root}/public/stylesheets/sass/variables.sass", 'w+') do |file| | |
file.write(sass_variables.join("\n")) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment