Created
June 16, 2011 23:22
-
-
Save fxposter/1030553 to your computer and use it in GitHub Desktop.
asset_path method to be used in sass files
This file contains 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
# 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