Module: Compass::Configuration::Adapters

### Home Classes Methods

### In Files

- lib/compass/configuration/adapters.rb

### Methods

- #absolute_path?
- #resolve_additional_import_paths
- #sass_3_4?
- #sass_load_paths
- #to_compiler_arguments
- #to_sass_engine_options
- #to_sass_plugin_options

### Class/Module Index

Quicksearch

- Compass
- Compass::BrowserSupport
- Compass::Configuration
- Compass::Configuration::Adapters
- Compass::Configuration::Data
- Compass::Configuration::Defaults
- Compass::Configuration::Inheritance
- Compass::Configuration::Inheritance::ClassMethods
- Compass::Configuration::Inheritance::ClassMethods::ArrayProxy
- Compass::Configuration::Inheritance::InstanceMethods
- Compass::Configuration::Paths
- Compass::Configuration::Watch
- Compass::Core
- Compass::Core::CanIUse
- Compass::Core::SassExtensions
- Compass::Core::SassExtensions::Functions
- Compass::Core::SassExtensions::Functions::Colors
- Compass::Core::SassExtensions::Functions::Configuration
- Compass::Core::SassExtensions::Functions::Constants
- Compass::Core::SassExtensions::Functions::CrossBrowserSupport
- Compass::Core::SassExtensions::Functions::CrossBrowserSupport::CSS2FallbackValue
- Compass::Core::SassExtensions::Functions::Display
- Compass::Core::SassExtensions::Functions::Enumerate
- Compass::Core::SassExtensions::Functions::Env
- Compass::Core::SassExtensions::Functions::Files
- Compass::Core::SassExtensions::Functions::FontFiles
- Compass::Core::SassExtensions::Functions::GradientSupport
- Compass::Core::SassExtensions::Functions::GradientSupport::Assertions
- Compass::Core::SassExtensions::Functions::GradientSupport::CSS3AngleToSVGConverter
- Compass::Core::SassExtensions::Functions::GradientSupport::ColorStop
- Compass::Core::SassExtensions::Functions::GradientSupport::Functions
- Compass::Core::SassExtensions::Functions::GradientSupport::Gradient
- Compass::Core::SassExtensions::Functions::GradientSupport::Gradient::ClassMethods
- Compass::Core::SassExtensions::Functions::GradientSupport::LinearGradient
- Compass::Core::SassExtensions::Functions::GradientSupport::RadialGradient
- Compass::Core::SassExtensions::Functions::ImageSize
- Compass::Core::SassExtensions::Functions::ImageSize::ImageProperties
- Compass::Core::SassExtensions::Functions::ImageSize::JPEG
- Compass::Core::SassExtensions::Functions::InlineImage
- Compass::Core::SassExtensions::Functions::Lists
- Compass::Core::SassExtensions::Functions::Math
- Compass::Core::SassExtensions::Functions::SassDeclarationHelper
- Compass::Core::SassExtensions::Functions::Selectors
- Compass::Core::SassExtensions::Functions::Urls
- Compass::Core::SassExtensions::Functions::Urls::FontUrl
- Compass::Core::SassExtensions::Functions::Urls::GeneratedImageUrl
- Compass::Core::SassExtensions::Functions::Urls::ImageUrl
- Compass::Core::SassExtensions::Functions::Urls::StylesheetUrl
- Compass::Error
- Compass::Frameworks
- Compass::Frameworks::Framework
- Compass::HasDeprecatedConstantsFromCore
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::Util
- Sass
- Sass::Script
- Sass::Script::CrossBrowserFunctionCall
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::HasSimpleCrossBrowserFunctionSupport
- Sass::Script::List
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Tree
- Sass::Tree::Node

No matching classes.

# Compass::Configuration::Adapters

The adapters module provides methods that make configuration data from a compass project adapt to various consumers of configuration data

### Public Instance Methods

absolute_path?(path) click to toggle source

    # File lib/compass/configuration/adapters.rb, line 57
    def absolute_path?(path)
      # Pretty basic implementation
      path.index(File::SEPARATOR) == 0 || path.index(':') == 1
    end

resolve_additional_import_paths() click to toggle source

    # File lib/compass/configuration/adapters.rb, line 47
    def resolve_additional_import_paths
      (additional_import_paths || []).map do |path|
        if path.is_a?(String) && project_path && !absolute_path?(path)
          File.join(project_path, path)
        else
          path
        end
      end
    end

sass_3_4?() click to toggle source

    # File lib/compass/configuration/adapters.rb, line 101
    def sass_3_4?
      Sass.version[:major] == 3 && Sass.version[:minor] == 4
    end

sass_load_paths() click to toggle source

    # File lib/compass/configuration/adapters.rb, line 80
    def sass_load_paths
      load_paths = []
      load_paths << sass_path if sass_path && File.directory?(sass_path)
      Compass::Frameworks::ALL.each do |f|
        load_paths << f.stylesheets_directory if File.directory?(f.stylesheets_directory)
      end
      importer = sass_options[:filesystem_importer] if sass_options && sass_options[:filesystem_importer]
      importer ||= Sass::Importers::Filesystem
      load_paths += resolve_additional_import_paths
      load_paths.map! do |p|
        next p if p.respond_to?(:find_relative)
        importer.new(p.to_s)
      end
      # TODO: When sprites are extracted to their own plugin, this
      # TODO: will need to be extracted to there.
      if defined?(Compass::SpriteImporter.new)
        load_paths << Compass::SpriteImporter.new
      end
      load_paths
    end

to_compiler_arguments(additional_options = {}) click to toggle source

    # File lib/compass/configuration/adapters.rb, line 6
    def to_compiler_arguments(additional_options = {})
      engine_opts = to_sass_engine_options.merge(additional_options)
      # we have to pass the quiet option in the nested :sass hash to disambiguate it from the compass compiler's own quiet option.
      if engine_opts.has_key?(:quiet)
        engine_opts[:sass] ||= {}
        engine_opts[:sass][:quiet] = engine_opts.delete(:quiet)
      end
      [project_path, sass_path, css_path, engine_opts]
    end

to_sass_engine_options() click to toggle source

    # File lib/compass/configuration/adapters.rb, line 62
    def to_sass_engine_options
      engine_opts = {:load_paths => sass_load_paths}
      engine_opts[:style] = output_style if output_style
      engine_opts[:line_comments] = line_comments
      if sass_3_4?
        engine_opts[:sourcemap] = sourcemap ? :auto : :none
      else
        engine_opts[:sourcemap] = sourcemap
      end
      engine_opts[:cache] = cache
      engine_opts[:cache_location] = cache_path
      engine_opts[:quiet] = disable_warnings if disable_warnings
      engine_opts[:compass] = {}
      engine_opts[:compass][:environment] = environment
      engine_opts[:full_exception] = (environment == :development)
      engine_opts.merge!(sass_options || {})
    end

to_sass_plugin_options() click to toggle source

    # File lib/compass/configuration/adapters.rb, line 16
    def to_sass_plugin_options
      locations = []
      locations << [sass_path, css_path] if sass_path && css_path
      Compass::Frameworks::ALL.each do |framework|
        locations << [framework.stylesheets_directory, File.join(css_path || css_dir || ".", framework.name)]
      end
      plugin_opts = {:template_location => locations}
      plugin_opts[:style] = output_style if output_style
      plugin_opts[:line_comments] = line_comments
      if sass_3_4?
        plugin_opts[:sourcemap] = sourcemap ? :auto : :none
      else
        plugin_opts[:sourcemap] = sourcemap
      end
      plugin_opts[:cache] = cache unless cache.nil?
      plugin_opts[:cache_location] = cache_path unless cache_path.nil?
      plugin_opts[:quiet] = disable_warnings if disable_warnings
      plugin_opts[:compass] = {}
      plugin_opts[:compass][:environment] = environment
      plugin_opts.merge!(sass_options || {})
      plugin_opts[:load_paths] ||= []
      plugin_opts[:load_paths] += resolve_additional_import_paths
      # TODO: When sprites are extracted to their own plugin, this
      # TODO: will need to be extracted to there.
      if defined?(Compass::SpriteImporter.new)
        plugin_opts[:load_paths] << Compass::SpriteImporter.new
      end
      plugin_opts[:full_exception] = (environment == :development)
      plugin_opts
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.