module Sass::Plugin::Configuration

Public Instance Methods

add_template_location(template_location, css_location = options[:css_location]) click to toggle source

Adds a new template-location/css-location mapping. This means that Sass/SCSS files in `template_location` will be compiled to CSS files in `css_location`.

This is preferred over manually manipulating the {file:SASS_REFERENCE.md#template_location-option `:template_location` option} since the option can be in multiple formats.

Note that this method will change `options` to be in the Array format. This means that even if `options` had previously been a Hash or a String, it will now be an Array.

@param template_location [String] The location where Sass/SCSS files will be. @param css_location [String] The location where compiled CSS files will go.

# File lib/sass/plugin/configuration.rb, line 62
def add_template_location(template_location, css_location = options[:css_location])
  normalize_template_location!
  template_location_array << [template_location, css_location]
end
default_options() click to toggle source

Different default options in a m envirionment.

# File lib/sass/plugin/merb.rb, line 6
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
options() click to toggle source

An options hash. See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.

@return [{Symbol => Object}]

# File lib/sass/plugin/configuration.rb, line 32
def options
  @options ||= default_options.dup
end
options=(value) click to toggle source

Sets the options hash. See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}. See {#reset!} @deprecated Instead, modify the options hash in-place. @param value [{Symbol => Object}] The options hash

# File lib/sass/plugin/configuration.rb, line 41
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
remove_template_location(template_location, css_location = options[:css_location]) click to toggle source

Removes a template-location/css-location mapping. This means that Sass/SCSS files in `template_location` will no longer be compiled to CSS files in `css_location`.

This is preferred over manually manipulating the {file:SASS_REFERENCE.md#template_location-option `:template_location` option} since the option can be in multiple formats.

Note that this method will change `options` to be in the Array format. This means that even if `options` had previously been a Hash or a String, it will now be an Array.

@param template_location [String]

The location where Sass/SCSS files were,
which is now going to be ignored.

@param css_location [String]

The location where compiled CSS files went, but will no longer go.

@return [Boolean]

Non-`nil` if the given mapping already existed and was removed,
or `nil` if nothing was changed.
# File lib/sass/plugin/configuration.rb, line 88
def remove_template_location(template_location, css_location = options[:css_location])
  normalize_template_location!
  template_location_array.delete([template_location, css_location])
end
reset!() click to toggle source

Resets the options and {Sass::Callbacks::InstanceMethods#clear_callbacks! clears all callbacks}.

# File lib/sass/plugin/configuration.rb, line 23
def reset!
  @options = nil
  clear_callbacks!
end
template_location_array() click to toggle source

Returns the template locations configured for Sass as an array of `[template_location, css_location]` pairs. See the {file:SASS_REFERENCE.md#template_location-option `:template_location` option} for details.

@return [Array<(String, String)>]

An array of `[template_location, css_location]` pairs.
# File lib/sass/plugin/configuration.rb, line 100
def template_location_array
  old_template_location = options[:template_location]
  normalize_template_location!
  options[:template_location]
ensure
  options[:template_location] = old_template_location
end