unless defined?(Sass::RAILS_LOADED)
  Sass::RAILS_LOADED = true

  Sass::Plugin.options.merge!(:template_location  => RAILS_ROOT + '/public/stylesheets/sass',
                              :css_location       => RAILS_ROOT + '/public/stylesheets',
                              :always_check       => RAILS_ENV != "production",
                              :full_exception     => RAILS_ENV != "production")
  
  module ActionController # :nodoc:
    class Base # :nodoc:
      alias_method :sass_old_process, :process
      def process(*args)
        Sass::Plugin.update_stylesheets if Sass::Plugin.options[:always_update] || Sass::Plugin.options[:always_check]
        sass_old_process(*args)
      end
    end
  end
end
