Skip to content

Instantly share code, notes, and snippets.

@fxposter
Created June 16, 2011 23:22
Show Gist options
  • Save fxposter/1030553 to your computer and use it in GitHub Desktop.
Save fxposter/1030553 to your computer and use it in GitHub Desktop.
asset_path method to be used in sass files
# Usage
# body {
# background: url(asset_path('background.png')) #FFFFFF;
# }
module Sass::Script::Functions
include Sprockets::Helpers::RailsHelper
def asset_path(path)
assert_type path, :String
Sass::Script::String.new(super(path.value), :string)
end
declare :asset_path, :args => [:string]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment