def asset_path(source, options = {})
      uri = URI.parse(source)
      return source if uri.absolute?

      options[:prefix] = Sprockets::Helpers.prefix unless options[:prefix]

      if Helpers.debug || options[:debug]
        options[:manifest] = false
        options[:digest] = false
        options[:asset_host] = false
      end

      source_ext = File.extname(source)

      if options[:ext] && source_ext != ".#{options[:ext]}"
        uri.path << ".#{options[:ext]}"
      end

      path = find_asset_path(uri, source, options)
      if options[:expand] && path.respond_to?(:to_a)
        path.to_a
      else
        path.to_s
      end
    end
def asset_path(source, options = {})
      uri = URI.parse(source)
      return source if uri.absolute?

      options[:prefix] = Sprockets::Helpers.prefix unless options[:prefix]

      if Helpers.debug || options[:debug]
        options[:manifest] = false
        options[:digest] = false
        options[:asset_host] = false
      end

      source_ext = File.extname(source)

      if options[:ext] && source_ext != ".#{options[:ext]}"
        uri.path << ".#{options[:ext]}"
      end

      path = find_asset_path(uri, source, options)
      if options[:expand] && path.respond_to?(:to_a)
        path.to_a
      else
        path.to_s
      end
    end
Returns the path to an asset either in the Sprockets environment
 or the public directory. External URIs are untouched.

 ==== Options

 * <tt>:ext</tt> - The extension to append if the source does not have one.
 * <tt>:dir</tt> - The directory to prepend if the file is in the public directory.
 * <tt>:digest</tt> - Wether or not use the digest paths for assets. Set Sprockets::Helpers.digest for global configuration.
 * <tt>:prefix</tt> - Use a custom prefix for the Sprockets environment. Set Sprockets::Helpers.prefix for global configuration.
 * <tt>:body</tt> - Adds a ?body=1 flag that tells Sprockets to return only the body of the asset.

 ==== Examples

 For files within Sprockets:

   asset_path 'xmlhr.js'                       # => '/assets/xmlhr.js'
   asset_path 'xmlhr', :ext => 'js'            # => '/assets/xmlhr.js'
   asset_path 'xmlhr.js', :digest => true      # => '/assets/xmlhr-27a8f1f96afd8d4c67a59eb9447f45bd.js'
   asset_path 'xmlhr.js', :prefix => '/themes' # => '/themes/xmlhr.js'

 For files outside of Sprockets:

   asset_path 'xmlhr'                                # => '/xmlhr'
   asset_path 'xmlhr', :ext => 'js'                  # => '/xmlhr.js'
   asset_path 'dir/xmlhr.js', :dir => 'javascripts'  # => '/javascripts/dir/xmlhr.js'
   asset_path '/dir/xmlhr.js', :dir => 'javascripts' # => '/dir/xmlhr.js'
   asset_path 'http://www.example.com/js/xmlhr'      # => 'http://www.example.com/js/xmlhr'
   asset_path 'http://www.example.com/js/xmlhr.js'   # => 'http://www.example.com/js/xmlhr.js'