Class: Sass::Plugin::Rack
- Inherits:
-  Object - Object
- Sass::Plugin::Rack
 
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/plugin/rack.rb
Overview
Rack middleware for compiling Sass code.
Activate
require 'sass/plugin/rack'
use Sass::Plugin::RackCustomize
Sass::Plugin.options.merge(
  :cache_location => './tmp/sass-cache',
  :never_update => environment != :production,
  :full_exception => environment != :production)See the Reference for more options.
Use
Put your Sass files in public/stylesheets/sass. Your CSS will be generated in public/stylesheets, and regenerated every request if necessary. The locations and frequency can be customized. That’s all there is to it!
Instance Attribute Summary (collapse)
-   - (Float) dwell   The delay, in seconds, between update checks. 
Instance Method Summary (collapse)
-   - ((#to_i, {String => String}, Object)) call(env)   Process a request, checking the Sass stylesheets for changes and updating them if necessary. 
-   - (Rack) initialize(app, dwell = 1.0)   constructor Initialize the middleware. 
Constructor Details
- (Rack) initialize(app, dwell = 1.0)
Initialize the middleware.
| 38 39 40 41 42 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/plugin/rack.rb', line 38
def initialize(app, dwell = 1.0)
  @app = app
  @dwell = dwell
  @check_after = Time.now.to_f
end | 
Instance Attribute Details
- (Float) dwell
The delay, in seconds, between update checks. Useful when many resources are requested for a single page. nil means no delay at all.
| 32 33 34 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/plugin/rack.rb', line 32
def dwell
  @dwell
end | 
Instance Method Details
- ((#to_i, {String => String}, Object)) call(env)
Process a request, checking the Sass stylesheets for changes and updating them if necessary.
| 49 50 51 52 53 54 55 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/plugin/rack.rb', line 49
def call(env)
  if @dwell.nil? || Time.now.to_f > @check_after
    Sass::Plugin.check_for_updates
    @check_after = Time.now.to_f + @dwell if @dwell
  end
  @app.call(env)
end |