class Sass::Plugin::Rack
That’s all there is to it!
The locations and frequency {file:SASS_REFERENCE.md#options can be customized}.
and regenerated every request if necessary.
Your CSS will be generated in ‘public/stylesheets`,
Put your Sass files in `public/stylesheets/sass`.
## Use
{file:SASS_REFERENCE.md#options See the Reference for more options}.
:full_exception => environment != :production)
:never_update => environment != :production,
:cache_location => ’./tmp/sass-cache’,
Sass::Plugin.options.merge(
## Customize
use Sass::Plugin::Rack
require ‘sass/plugin/rack’
## Activate
Rack middleware for compiling Sass code.
def self.disable_native_plugin!
This is automatically done once the Rack plugin is activated.
Disable the native Rails or Merb plugins, if they're enabled.
def self.disable_native_plugin! if defined?(Merb::Rack::Application) && Haml::Util.has?(:instance_method, Merb::Rack::Application, :call_without_sass) Merb::Rack::Application.instance_eval {alias_method :call, :call_without_sass} end if defined?(ActionDispatch::Callbacks.to_prepare) ActionDispatch::Callbacks.skip_callback(:prepare, :__sass_process) elsif defined?(ActionController::Base) && Haml::Util.has?(:instance_method, ActionController::Base, :sass_old_process) ActionController::Base.instance_eval {alias_method :process, :sass_old_process} end end
def call(env)
-
((#to_i, {String => String}, Object))
- The Rack response
Parameters:
-
env
() -- The Rack request environment
def call(env) Sass::Plugin.check_for_updates @app.call(env) end
def initialize(app)
-
app
(#call
) -- The Rack application
def initialize(app) @app = app self.class.disable_native_plugin! end