module Sass::Plugin::Configuration

def add_template_location(template_location, css_location = options[:css_location])

Parameters:
  • css_location (String) -- The location where compiled CSS files will go.
  • template_location (String) -- The location where Sass/SCSS files will be.
def add_template_location(template_location, css_location = options[:css_location])
  normalize_template_location!
  template_location_array << [template_location, css_location]
end

def default_options

Returns:
  • ({Symbol => Object}) -
def default_options
  @default_options ||= {
    :css_location       => './public/stylesheets',
    :always_update      => false,
    :always_check       => true,
    :full_exception     => true,
    :cache_location     => ".sass-cache"
  }.freeze
end

def default_options

Different default options in a m envirionment.
def default_options
  @default_options ||= begin
    version = Merb::VERSION.split('.').map { |n| n.to_i }
    if version[0] <= 0 && version[1] < 5
      root = MERB_ROOT
      env  = MERB_ENV
    else
      root = Merb.root.to_s
      env  = Merb.environment
    end
    {
      :always_update      => false,
      :template_location => root + '/public/stylesheets/sass',
      :css_location      => root + '/public/stylesheets',
      :cache_location    => root + '/tmp/sass-cache',
      :always_check      => env != "production",
      :quiet             => env != "production",
      :full_exception    => env != "production"
    }.freeze
  end
end

def default_options

Different default options in a rails envirionment.
def default_options
  return @default_options if @default_options
  opts = {
    :quiet             => Sass::Util.rails_env != "production",
    :full_exception    => Sass::Util.rails_env != "production",
    :cache_location    => Sass::Util.rails_root + '/tmp/sass-cache'
  }
  opts.merge!(
    :always_update     => false,
    :template_location => Sass::Util.rails_root + '/public/stylesheets/sass',
    :css_location      => Sass::Util.rails_root + '/public/stylesheets',
    :always_check      => Sass::Util.rails_env == "development")
  @default_options = opts.freeze
end

def normalize_template_location!

def normalize_template_location!
  return if options[:template_location].is_a?(Array)
  options[:template_location] =
    case options[:template_location]
    when nil
      options[:css_location] ?
        [[File.join(options[:css_location], 'sass'), options[:css_location]]] : []
    when String; [[options[:template_location], options[:css_location]]]
    else; options[:template_location].to_a
    end
end

def options

Returns:
  • ({Symbol => Object}) -
def options
  @options ||= default_options.dup
end

def options=(value)

Parameters:
  • value ({Symbol => Object}) -- The options hash

Deprecated:
  • Instead, modify the options hash in-place.
def options=(value)
  Sass::Util.sass_warn("Setting Sass::Plugin.options is deprecated " +
                       "and will be removed in a future release.")
  options.merge!(value)
end

def remove_template_location(template_location, css_location = options[:css_location])

Returns:
  • (Boolean) -

Parameters:
  • css_location (String) --
  • template_location (String) --
def remove_template_location(template_location, css_location = options[:css_location])
  normalize_template_location!
  template_location_array.delete([template_location, css_location])
end

def reset!

Resets the options and {Sass::Callbacks::InstanceMethods#clear_callbacks! clears all callbacks}.
def reset!
  @options = nil
  clear_callbacks!
end

def template_location_array

Returns:
  • (Array<(String, String)>) -
def template_location_array
  old_template_location = options[:template_location]
  normalize_template_location!
  options[:template_location]
ensure
  options[:template_location] = old_template_location
end