Module: Sass::Plugin::Configuration
- Included in:
- Compiler
- Defined in:
- .ruby-sass/lib/sass/plugin/configuration.rb
Overview
We keep configuration in its own self-contained file so that we can load it independently in Rails 3, where the full plugin stuff is lazy-loaded.
Note that this is not guaranteed to be thread-safe. For guaranteed thread safety, use a separate Sass::Plugin for each thread.
Instance Method Summary (collapse)
-
#add_template_location(template_location, css_location = options[:css_location]) ⇒ Object
Adds a new template-location/css-location mapping.
-
#default_options ⇒ {Symbol => Object}
Returns the default options for a Compiler.
-
#options ⇒ {Symbol => Object}
An options hash.
-
#remove_template_location(template_location, css_location = options[:css_location]) ⇒ Boolean
Removes a template-location/css-location mapping.
-
#reset! ⇒ Object
Resets the options and clears all callbacks.
-
#template_location_array ⇒ Array<(String, String)>
Returns the template locations configured for Sass as an array of `[template_location, css_location]` pairs.
Instance Method Details
#add_template_location(template_location, css_location = options[:css_location]) ⇒ Object
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` 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.
53 54 55 56 |
# File '.ruby-sass/lib/sass/plugin/configuration.rb', line 53 def add_template_location(template_location, css_location = [:css_location]) normalize_template_location! template_location_array << [template_location, css_location] end |
#default_options ⇒ {Symbol => Object}
Returns the default options for a Sass::Plugin::Compiler.
12 13 14 15 16 17 18 19 20 |
# File '.ruby-sass/lib/sass/plugin/configuration.rb', line 12 def @default_options ||= { :css_location => './public/stylesheets', :always_update => false, :always_check => true, :full_exception => true, :cache_location => ".sass-cache" }.freeze end |
#options ⇒ {Symbol => Object}
An options hash. See the Sass options documentation.
33 34 35 |
# File '.ruby-sass/lib/sass/plugin/configuration.rb', line 33 def @options ||= .dup end |
#remove_template_location(template_location, css_location = options[:css_location]) ⇒ Boolean
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` 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.
80 81 82 83 |
# File '.ruby-sass/lib/sass/plugin/configuration.rb', line 80 def remove_template_location(template_location, css_location = [:css_location]) normalize_template_location! template_location_array.delete([template_location, css_location]) end |
#reset! ⇒ Object
Resets the options and clears all callbacks.
24 25 26 27 |
# File '.ruby-sass/lib/sass/plugin/configuration.rb', line 24 def reset! @options = nil clear_callbacks! end |
#template_location_array ⇒ Array<(String, String)>
Returns the template locations configured for Sass as an array of `[template_location, css_location]` pairs. See the `:template_location` option for details.
Modifications to the returned array may not be persistent. Use #add_template_location and #remove_template_location instead.
95 96 97 |
# File '.ruby-sass/lib/sass/plugin/configuration.rb', line 95 def template_location_array convert_template_location([:template_location], [:css_location]) end |