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 convert_template_location(template_location, css_location)

Returns:
  • (Array<(String, String)>) -

Parameters:
  • css_location (String?) --
  • template_location (String, Array<(String, String)>) --
def convert_template_location(template_location, css_location)
  return template_location if template_location.is_a?(Array)
  case template_location
  when nil
    if css_location
      [[File.join(css_location, 'sass'), css_location]]
    else
      []
    end
  when String
    [[template_location, css_location]]
  else
    template_location.to_a
  end
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 environment.
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 environment.
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!
  options[:template_location] = convert_template_location(
    options[:template_location], options[:css_location])
end

def options

Returns:
  • ({Symbol => Object}) -
def options
  @options ||= default_options.dup
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!

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

def template_location_array

Returns:
  • (Array<(String, String)>) -
def template_location_array
  convert_template_location(options[:template_location], options[:css_location])
end