Module: Sprockets::SassProcessor::Functions

### Home Classes Methods

### In Files

- lib/sprockets/sass_processor.rb

### Methods

- #asset_data_url
- #asset_path
- #asset_url
- #audio_path
- #audio_url
- #font_path
- #font_url
- #image_path
- #image_url
- #javascript_path
- #javascript_url
- #sprockets_context
- #sprockets_dependencies
- #sprockets_environment
- #stylesheet_path
- #stylesheet_url
- #video_path
- #video_url

### Class/Module Index

Quicksearch

- Sprockets
- Sprockets::ArgumentError
- Sprockets::Asset
- Sprockets::Autoload
- Sprockets::Base
- Sprockets::Bower
- Sprockets::Bundle
- Sprockets::Cache
- Sprockets::Cache::FileStore
- Sprockets::Cache::GetWrapper
- Sprockets::Cache::HashWrapper
- Sprockets::Cache::MemoryStore
- Sprockets::Cache::NullStore
- Sprockets::Cache::ReadWriteWrapper
- Sprockets::Cache::Wrapper
- Sprockets::CachedEnvironment
- Sprockets::ClosureCompressor
- Sprockets::CoffeeScriptProcessor
- Sprockets::CoffeeScriptTemplate
- Sprockets::Compressing
- Sprockets::Configuration
- Sprockets::ContentTypeMismatch
- Sprockets::Context
- Sprockets::ConversionError
- Sprockets::Dependencies
- Sprockets::DigestUtils
- Sprockets::DirectiveProcessor
- Sprockets::ERBProcessor
- Sprockets::ERBTemplate
- Sprockets::EcoProcessor
- Sprockets::EcoTemplate
- Sprockets::EjsProcessor
- Sprockets::EjsTemplate
- Sprockets::EncodingUtils
- Sprockets::Engines
- Sprockets::Environment
- Sprockets::Error
- Sprockets::FileNotFound
- Sprockets::FileOutsidePaths
- Sprockets::FileReader
- Sprockets::HTTPUtils
- Sprockets::Index
- Sprockets::JstProcessor
- Sprockets::LegacyProcProcessor
- Sprockets::LegacyTiltProcessor
- Sprockets::Loader
- Sprockets::Manifest
- Sprockets::ManifestUtils
- Sprockets::Mime
- Sprockets::NotFound
- Sprockets::NotImplementedError
- Sprockets::PathDependencyUtils
- Sprockets::PathDigestUtils
- Sprockets::PathUtils
- Sprockets::Paths
- Sprockets::Processing
- Sprockets::ProcessorUtils
- Sprockets::Resolve
- Sprockets::SassCompressor
- Sprockets::SassProcessor
- Sprockets::SassProcessor::CacheStore
- Sprockets::SassProcessor::Functions
- Sprockets::SassTemplate
- Sprockets::ScssProcessor
- Sprockets::ScssTemplate
- Sprockets::Server
- Sprockets::Transformers
- Sprockets::URITar
- Sprockets::URIUtils
- Sprockets::UglifierCompressor
- Sprockets::UnloadedAsset
- Sprockets::Utils
- Sprockets::YUICompressor
- Rake
- Rake::SprocketsTask

No matching classes.

# Sprockets::SassProcessor::Functions

Public: Functions injected into Sass context during Sprockets evaluation.

This module may be extended to add global functionality to all Sprockets Sass environments. Though, scoping your functions to just your environment is preferred.

module Sprockets::SassProcessor::Functions

    def asset_path(path, options = {})
    end

end

### Public Instance Methods

asset_data_url(path) click to toggle source

Public: Generate a data URI for asset path.

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

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 241
    def asset_data_url(path)
      url = sprockets_context.asset_data_uri(path.value)
      Autoload::Sass::Script::String.new("url(" + url + ")")
    end

asset_path(path, options = {}) click to toggle source

Public: Generate a url for asset path.

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

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

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 108
    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

asset_url(path, options = {}) click to toggle source

Public: Generate a asset url() link.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 124
    def asset_url(path, options = {})
      Autoload::Sass::Script::String.new("url(#{asset_path(path, options).value})")
    end

audio_path(path) click to toggle source

Public: Generate url for audio path.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 169
    def audio_path(path)
      asset_path(path, type: :audio)
    end

audio_url(path) click to toggle source

Public: Generate a audio url() link.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 178
    def audio_url(path)
      asset_url(path, type: :audio)
    end

font_path(path) click to toggle source

Public: Generate url for font path.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 187
    def font_path(path)
      asset_path(path, type: :font)
    end

font_url(path) click to toggle source

Public: Generate a font url() link.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 196
    def font_url(path)
      asset_url(path, type: :font)
    end

image_path(path) click to toggle source

Public: Generate url for image path.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 133
    def image_path(path)
      asset_path(path, type: :image)
    end

image_url(path) click to toggle source

Public: Generate a image url() link.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 142
    def image_url(path)
      asset_url(path, type: :image)
    end

javascript_path(path) click to toggle source

Public: Generate url for javascript path.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 205
    def javascript_path(path)
      asset_path(path, type: :javascript)
    end

javascript_url(path) click to toggle source

Public: Generate a javascript url() link.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 214
    def javascript_url(path)
      asset_url(path, type: :javascript)
    end

stylesheet_path(path) click to toggle source

Public: Generate url for stylesheet path.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 223
    def stylesheet_path(path)
      asset_path(path, type: :stylesheet)
    end

stylesheet_url(path) click to toggle source

Public: Generate a stylesheet url() link.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 232
    def stylesheet_url(path)
      asset_url(path, type: :stylesheet)
    end

video_path(path) click to toggle source

Public: Generate url for video path.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 151
    def video_path(path)
      asset_path(path, type: :video)
    end

video_url(path) click to toggle source

Public: Generate a video url() link.

path - Sass::Script::String URL path

Returns a Sass::Script::String.

    # File lib/sprockets/sass_processor.rb, line 160
    def video_url(path)
      asset_url(path, type: :video)
    end

### Protected Instance Methods

sprockets_context() click to toggle source

Deprecated: Get the Context instance. Use APIs on sprockets_environment or sprockets_dependencies directly.

Returns a Context instance.

    # File lib/sprockets/sass_processor.rb, line 265
    def sprockets_context
      options[:sprockets][:context]
    end

sprockets_dependencies() click to toggle source

Public: Mutatable set of dependencies.

Returns a Set.

    # File lib/sprockets/sass_processor.rb, line 257
    def sprockets_dependencies
      options[:sprockets][:dependencies]
    end

sprockets_environment() click to toggle source

Public: The Environment.

Returns Sprockets::Environment.

    # File lib/sprockets/sass_processor.rb, line 250
    def sprockets_environment
      options[:sprockets][:environment]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.