Module: Compass::Core::SassExtensions::Functions::Configuration

### Home Classes Methods

### In Files

- lib/compass/core/sass_extensions/functions/configuration.rb

### Methods

- #absolute_path
- #add_configuration
- #add_sass_configuration
- #join_file_segments
- #reset_configuration
- #split_filename
- #using_compass_compiler

### 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::Core::SassExtensions::Functions::Configuration

### Constants

OPTION_TRANSFORMER

### Public Instance Methods

absolute_path(relative_path) click to toggle source

Returns an absolute path for the path relative to the sass file it was called from.

    # File lib/compass/core/sass_extensions/functions/configuration.rb, line 13
    def absolute_path(relative_path)
      quoted_string(File.expand_path(File.join(File.dirname(options[:filename]), relative_path.value)))
    end

add_configuration(options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/configuration.rb, line 127
    def add_configuration(options)
      attributes = {}
      options.value.keys.each do |key|
        underscored = key.value.to_s.tr("-", "_")
        unless runtime_writable_attributes.find{|a| a.to_s == underscored}
          raise ArgumentError, "#{key} is not a valid configuration option."
        end
        underscored = underscored.to_sym
        attributes[underscored] = OPTION_TRANSFORMER[underscored].call(options.value[key], self)
      end
      name = "#{options.source_range.file}:#{options.source_range.start_pos.line}"
      Compass.add_configuration(Compass::Configuration::Data.new(name, attributes))
      update_sass_options!
      null
    end

add_sass_configuration(project_path) click to toggle source

    # File lib/compass/core/sass_extensions/functions/configuration.rb, line 40
    def add_sass_configuration(project_path)
      css_location = template_location = nil
      if options[:template_location] && options[:template_location].is_a?(Array)
        css_location = File.expand_path(options[:template_location].first.last)
        template_location = File.expand_path(options[:template_location].first.first)
      else
        css_location = File.expand_path(options[:css_location]) if options[:css_location]
        template_location = File.expand_path(options[:template_location]) if options[:template_location]
      end
      original_filename = File.expand_path(options[:original_filename]) if options[:original_filename]
      project_path = if project_path.value.nil?
                       if css_location && template_location
                         common_parent_directory(css_location, template_location)
                       end
                     else
                       project_path.value
                     end
      config = {
        :project_path => project_path,
        :cache => options[:cache],
        :additional_import_paths => options[:load_paths],
        :line_comments => options[:line_comments]
      }
      unless options[:quiet].nil?
        config.update(:disable_warnings => options[:quiet])
      end
      if project_path && css_location && (css_dir = relative_path_from(css_location, project_path))
        config.update(:css_dir => css_dir)
      elsif css_location
        config.update(:css_path => css_location)
      end
      if project_path && template_location && (sass_dir = relative_path_from(template_location, project_path))
        config.update(:sass_dir => sass_dir)
      elsif template_location
        config.update(:css_path => template_location)
      end
      config_name = "Sass Defaults: #{project_path ? relative_path_from(original_filename, project_path) : original_filename}"
      Compass.add_configuration(Compass::Configuration::Data.new(config_name, config))
      update_sass_options!
      null
    rescue => e
      puts e.backtrace.join("\n")
      raise
    end

join_file_segments(*segments) click to toggle source

Users who need to support windows and unix paths in their configuration should construct them with this helper function.

    # File lib/compass/core/sass_extensions/functions/configuration.rb, line 7
    def join_file_segments(*segments)
      quoted_string(File.join(*segments.map{|s| assert_type s, :String; s.value}))
    end

reset_configuration() click to toggle source

    # File lib/compass/core/sass_extensions/functions/configuration.rb, line 34
    def reset_configuration()
      Compass.reset_configuration!
      null()
    end

split_filename(path) click to toggle source

split a file into directory, basename, and extension

    # File lib/compass/core/sass_extensions/functions/configuration.rb, line 19
    def split_filename(path)
      pathname = Pathname.new(path.value)
      list(quoted_string(pathname.dirname.to_s),
           quoted_string(pathname.basename(pathname.extname).to_s),
           quoted_string(pathname.extname.to_s),
           :space)
    end

using_compass_compiler() click to toggle source

Returns true if the compass compiler is compiling this stylesheet.

    # File lib/compass/core/sass_extensions/functions/configuration.rb, line 29
    def using_compass_compiler
      bool(options[:compass] && options[:compass][:compiler_in_use])
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.