Skip to content

Instantly share code, notes, and snippets.

@unixmonkey
Created March 5, 2010 21:45
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save unixmonkey/323198 to your computer and use it in GitHub Desktop.
Save unixmonkey/323198 to your computer and use it in GitHub Desktop.
initializer to load a yaml file into sass variables
# 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