Module: Sass::Plugin
Overview
This module contains methods to aid in using Sass as a stylesheet-rendering plugin for various systems. Currently Rails/ActionController and Merb are supported out of the box.
Instance Method Summary collapse
-
#checked_for_updates ⇒ Object
Whether or not Sass has ever checked if the stylesheets need updates (in this Ruby instance).
-
#engine_options(additional_options = {}) ⇒ Object
Get the options ready to be passed to the Sass::Engine.
-
#options ⇒ Object
Gets various options for Sass.
-
#options=(value) ⇒ Object
Sets various options for Sass.
-
#update_stylesheets ⇒ Object
Checks each stylesheet in
options[:css_location]
to see if it needs updating, and updates it using the corresponding template fromoptions[:templates]
if it does.
Instance Method Details
#checked_for_updates ⇒ Object
Whether or not Sass has ever checked if the stylesheets need updates (in this Ruby instance).
20 21 22 |
# File 'lib/sass/plugin.rb', line 20 def checked_for_updates @checked_for_updates end |
#engine_options(additional_options = {}) ⇒ Object
Get the options ready to be passed to the Sass::Engine
38 39 40 41 42 |
# File 'lib/sass/plugin.rb', line 38 def ( = {}) opts = .dup.merge() opts[:load_paths] = load_paths(opts) opts end |
#options ⇒ Object
Gets various options for Sass. See README.rdoc for details. – TODO: *DOCUMENT OPTIONS* ++
28 29 30 |
# File 'lib/sass/plugin.rb', line 28 def end |
#options=(value) ⇒ Object
Sets various options for Sass.
33 34 35 |
# File 'lib/sass/plugin.rb', line 33 def (value) .merge!(value) end |
#update_stylesheets ⇒ Object
Checks each stylesheet in options[:css_location]
to see if it needs updating, and updates it using the corresponding template from options[:templates]
if it does.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/sass/plugin.rb', line 49 def update_stylesheets return if [:never_update] @checked_for_updates = true template_locations.zip(css_locations).each do |template_location, css_location| Dir.glob(File.join(template_location, "**", "*.sass")).each do |file| # Get the relative path to the file with no extension name = file.sub(template_location + "/", "")[0...-5] if !forbid_update?(name) && ([:always_update] || stylesheet_needs_update?(name, template_location, css_location)) update_stylesheet(name, template_location, css_location) end end end end |