/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

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