module Sprockets::SassProcessor::Functions

def asset_data_url(path)

Returns a Sass::Script::String.

path - Sass::Script::String logical asset path

Public: Generate a data URI for asset path.
def asset_data_url(path)
  url = sprockets_context.asset_data_uri(path.value)
  Autoload::Sass::Script::String.new("url(" + url + ")")
end

def asset_path(path, options = {})

Returns a Sass::Script::String.

own base implementation.
Will raise NotImplementedError in the future. Users should provide their

Context#asset_path.
Default implementation is deprecated. Currently defaults to

Public: Generate a url for asset path.
def asset_path(path, options = {})
  path = path.value
  path, _, query, fragment = URI.split(path)[5..8]
  path     = sprockets_context.asset_path(path, options)
  query    = "?#{query}" if query
  fragment = "##{fragment}" if fragment
  Autoload::Sass::Script::String.new("#{path}#{query}#{fragment}", :string)
end

def asset_url(path, options = {})

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate a asset url() link.
def asset_url(path, options = {})
  Autoload::Sass::Script::String.new("url(#{asset_path(path, options).value})")
end

def audio_path(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate url for audio path.
def audio_path(path)
  asset_path(path, type: :audio)
end

def audio_url(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate a audio url() link.
def audio_url(path)
  asset_url(path, type: :audio)
end

def font_path(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate url for font path.
def font_path(path)
  asset_path(path, type: :font)
end

def font_url(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate a font url() link.
def font_url(path)
  asset_url(path, type: :font)
end

def image_path(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate url for image path.
def image_path(path)
  asset_path(path, type: :image)
end

def image_url(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate a image url() link.
def image_url(path)
  asset_url(path, type: :image)
end

def javascript_path(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate url for javascript path.
def javascript_path(path)
  asset_path(path, type: :javascript)
end

def javascript_url(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate a javascript url() link.
def javascript_url(path)
  asset_url(path, type: :javascript)
end

def sprockets_context

Returns a Context instance.

sprockets_environment or sprockets_dependencies directly.
Deprecated: Get the Context instance. Use APIs on
def sprockets_context
  options[:sprockets][:context]
end

def sprockets_dependencies

Returns a Set.

Public: Mutatable set of dependencies.
def sprockets_dependencies
  options[:sprockets][:dependencies]
end

def sprockets_environment

Returns Sprockets::Environment.

Public: The Environment.
def sprockets_environment
  options[:sprockets][:environment]
end

def stylesheet_path(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate url for stylesheet path.
def stylesheet_path(path)
  asset_path(path, type: :stylesheet)
end

def stylesheet_url(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate a stylesheet url() link.
def stylesheet_url(path)
  asset_url(path, type: :stylesheet)
end

def video_path(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate url for video path.
def video_path(path)
  asset_path(path, type: :video)
end

def video_url(path)

Returns a Sass::Script::String.

path - Sass::Script::String URL path

Public: Generate a video url() link.
def video_url(path)
  asset_url(path, type: :video)
end