lib/sprockets/helpers.rb in sprockets-helpers-0.2.0 vs lib/sprockets/helpers.rb in sprockets-helpers-0.2.1
- old
+ new
@@ -82,10 +82,11 @@
end
# Use FilePath for normal files on the file system
FilePath.new(source, options).to_s
end
+ alias_method :path_to_asset, :asset_path
# Computes the path to a javascript asset either in the Sprockets
# environment or the public directory. If the +source+ filename has no extension,
# <tt>.js</tt> will be appended. External URIs are untouched.
#
@@ -106,10 +107,11 @@
# javascript_path "http://www.example.com/js/xmlhr.js" # => "http://www.example.com/js/xmlhr.js"
#
def javascript_path(source, options = {})
asset_path source, { :dir => "javascripts", :ext => "js" }.merge(options)
end
+ alias_method :path_to_javascript, :javascript_path
# Computes the path to a stylesheet asset either in the Sprockets
# environment or the public directory. If the +source+ filename has no extension,
# <tt>.css</tt> will be appended. External URIs are untouched.
#
@@ -130,10 +132,11 @@
# stylesheet_path "http://www.example.com/css/style.css" # => "http://www.example.com/css/style.css"
#
def stylesheet_path(source, options = {})
asset_path source, { :dir => "stylesheets", :ext => "css" }.merge(options)
end
+ alias_method :path_to_stylesheet, :stylesheet_path
# Computes the path to an image asset either in the Sprockets environment
# or the public directory. External URIs are untouched.
#
# ==== Examples
@@ -153,9 +156,10 @@
# image_path "http://www.example.com/img/edit.png" # => "http://www.example.com/img/edit.png"
#
def image_path(source, options = {})
asset_path source, { :dir => "images" }.merge(options)
end
+ alias_method :path_to_image, :image_path
protected
# Returns the Sprockets environment #asset_path uses to search for
# assets. This can be overridden for more control, if necessary.