PageRenderTime 24ms CodeModel.GetById 11ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/scalate-jruby/src/main/resources/haml-3.0.25/lib/sass/plugin/rails.rb

http://github.com/scalate/scalate
Ruby | 32 lines | 27 code | 2 blank | 3 comment | 4 complexity | 4efbdd4ab3f002520d35c26280e102a1 MD5 | raw file
 1unless defined?(Sass::RAILS_LOADED)
 2  Sass::RAILS_LOADED = true
 3
 4  # Reverse-merging (we're in Rails, anyway) so we dont' clobber what's already been defined further up-stream
 5  Sass::Plugin.options.reverse_merge!(:template_location => Haml::Util.rails_root + '/public/stylesheets/sass',
 6                                      :css_location      => Haml::Util.rails_root + '/public/stylesheets',
 7                                      :cache_location    => Haml::Util.rails_root + '/tmp/sass-cache',
 8                                      :always_check      => Haml::Util.rails_env == "development",
 9                                      :quiet             => Haml::Util.rails_env != "production",
10                                      :full_exception    => Haml::Util.rails_env != "production")
11
12  if defined?(ActionController::Metal)
13    # Rails >= 3.0
14    require 'sass/plugin/rack'
15    Rails.configuration.middleware.use(Sass::Plugin::Rack)
16  elsif defined?(ActionController::Dispatcher) &&
17      defined?(ActionController::Dispatcher.middleware)
18    # Rails >= 2.3
19    require 'sass/plugin/rack'
20    ActionController::Dispatcher.middleware.use(Sass::Plugin::Rack)
21  else
22    module ActionController
23      class Base
24        alias_method :sass_old_process, :process
25        def process(*args)
26          Sass::Plugin.check_for_updates
27          sass_old_process(*args)
28        end
29      end
30    end
31  end
32end