Module Sass::Plugin
In: lib/sass/plugin.rb

This module handles the compilation of Sass files. It provides global options and checks whether CSS files need to be updated.

This module is used as the primary interface with Sass when it‘s used as a plugin for various frameworks. Currently Rails and Merb are supported out of the box.

Methods

Attributes

checked_for_updates  [R]  Whether or not Sass has *ever* checked if the stylesheets need to be updated (in this Ruby instance).

@return [Boolean]

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

@return [Hash<Symbol, Object>]

Public Instance methods

Non-destructively modifies \{options} so that default values are properly set.

@param additional_options [Hash<Symbol, Object>] An options hash with which to merge \{options} @return [Hash<Symbol, Object>] The modified options hash

[Source]

    # File lib/sass/plugin.rb, line 46
46:     def engine_options(additional_options = {})
47:       opts = options.dup.merge(additional_options)
48:       opts[:load_paths] = load_paths(opts)
49:       opts
50:     end

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

@param value [Hash<Symbol, Object>] The options hash

[Source]

    # File lib/sass/plugin.rb, line 38
38:     def options=(value)
39:       @options.merge!(value)
40:     end

Updates out-of-date stylesheets.

Checks each Sass file in {file:SASS_REFERENCE.md#template_location-option `:template_location`} to see if it‘s been modified more recently than the corresponding CSS file in {file:SASS_REFERENCE.md#css_location-option} `:css_location`}. If it has, it updates the CSS file.

[Source]

    # File lib/sass/plugin.rb, line 58
58:     def update_stylesheets
59:       return if options[:never_update]
60: 
61:       @checked_for_updates = true
62:       template_locations.zip(css_locations).each do |template_location, css_location|
63: 
64:         Dir.glob(File.join(template_location, "**", "*.sass")).each do |file|
65:           # Get the relative path to the file with no extension
66:           name = file.sub(template_location + "/", "")[0...-5]
67: 
68:           if !forbid_update?(name) && (options[:always_update] || stylesheet_needs_update?(name, template_location, css_location))
69:             update_stylesheet(name, template_location, css_location)
70:           end
71:         end
72:       end
73:     end

[Validate]