Skip to content

Instantly share code, notes, and snippets.

@joshuacronemeyer
Created January 16, 2014 21:25
Show Gist options
  • Save joshuacronemeyer/8463695 to your computer and use it in GitHub Desktop.
Save joshuacronemeyer/8463695 to your computer and use it in GitHub Desktop.
Add your own sass helpers if you're using the sass-rails gems
html {
background: background_url_from_config() no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#with sass-rails you get some helpers like asset-url and asset-path
#you can add your own like this
module Sprockets
module SassFunctions
def background_url_from_config
Sass::Script::String.new("url(#{ENV['CDN_BG_IMAGE']})")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment