Module: Sass::Plugin::Configuration

Defined in:
/var/www/sass-pages/.sass/lib/sass/plugin/configuration.rb

Instance Method Summary

Instance Method Details

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

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 :template_location option since the option can be in multiple formats.

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

Parameters:

  • (String) template_location — The location where Sass/SCSS files will be.
  • (String) css_location (defaults to: options[:css_location]) — The location where compiled CSS files will go.


62
63
64
65
# File '/var/www/sass-pages/.sass/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

- ({Symbol => Object}) default_options

Returns the default options for a Sass::Plugin::Compiler.

Returns:

  • ({Symbol => Object})


12
13
14
15
16
17
18
19
20
# File '/var/www/sass-pages/.sass/lib/sass/plugin/configuration.rb', line 12

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

- ({Symbol => Object}) options

An options hash. See the Sass options documentation.

Returns:

  • ({Symbol => Object})


32
33
34
# File '/var/www/sass-pages/.sass/lib/sass/plugin/configuration.rb', line 32

def options
  @options ||= default_options.dup
end

- options=(value)

Deprecated. Instead, modify the options hash in-place.

Sets the options hash. See the Sass options documentation. See Sass::Plugin::Configuration#reset!

Parameters:

  • ({Symbol => Object}) value — The options hash


41
42
43
44
45
# File '/var/www/sass-pages/.sass/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

- (Boolean) remove_template_location(template_location, css_location = options[:css_location])

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 :template_location option since the option can be in multiple formats.

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

Parameters:

  • (String) template_location — The location where Sass/SCSS files were, which is now going to be ignored.
  • (String) css_location (defaults to: options[:css_location]) — The location where compiled CSS files went, but will no longer go.

Returns:

  • (Boolean) — Non-nil if the given mapping already existed and was removed, or nil if nothing was changed.


88
89
90
91
# File '/var/www/sass-pages/.sass/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!

Resets the options and clears all callbacks.



23
24
25
26
# File '/var/www/sass-pages/.sass/lib/sass/plugin/configuration.rb', line 23

def reset!
  @options = nil
  clear_callbacks!
end

- (Array<(String, String)>) template_location_array

Returns the template locations configured for Sass as an array of [template_location, css_location] pairs. See the :template_location option for details.

Returns:

  • (Array<(String, String)>) — An array of [template_location, css_location] pairs.


100
101
102
103
104
105
106
# File '/var/www/sass-pages/.sass/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