Class: Sass::Plugin::Rack

Inherits:
Object show all
Defined in:
/var/www/haml-pages/.haml/lib/sass/plugin/rack.rb

Overview

Rack middleware for compiling Sass code.

Activate

require 'sass/plugin/rack'
use Sass::Plugin::Rack

Customize

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 Method Summary

Constructor Details

- (Rack) initialize(app)

Initialize the middleware.

Parameters:

  • (#call) app — The Rack application


30
31
32
# File '/var/www/haml-pages/.haml/lib/sass/plugin/rack.rb', line 30

def initialize(app)
  @app = app
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.

Parameters:

  • env — The Rack request environment

Returns:

  • ((#to_i, {String => String}, Object)) — The Rack response


39
40
41
42
# File '/var/www/haml-pages/.haml/lib/sass/plugin/rack.rb', line 39

def call(env)
  Sass::Plugin.check_for_updates
  @app.call(env)
end