Sha256: a72e755be7a2816927cfc340390d5d7feb22281beb027df61bfba9e8dccd03f0

Contents?: true

Size: 1.7 KB

Versions: 17

Compression:

Stored size: 1.7 KB

Contents

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

  version = Merb::VERSION.split('.').map { |n| n.to_i }
  if version[0] <= 0 && version[1] < 5
    root = MERB_ROOT
    env  = MERB_ENV
  else
    root = Merb.root.to_s
    env  = Merb.environment
  end

  Sass::Plugin.options.merge!(:template_location => root + '/public/stylesheets/sass',
                              :css_location      => root + '/public/stylesheets',
                              :cache_location    => root + '/tmp/sass-cache',
                              :always_check      => env != "production",
                              :full_exception    => env != "production")
  config = Merb::Plugins.config[:sass] || Merb::Plugins.config["sass"] || {}

  if defined? config.symbolize_keys!
    config.symbolize_keys!
  end

  Sass::Plugin.options.merge!(config)

  if version[0] > 0 || version[1] >= 9

    class Merb::Rack::Application # :nodoc:
      def call_with_sass(env)
        if !Sass::Plugin.checked_for_updates ||
            Sass::Plugin.options[:always_update] || Sass::Plugin.options[:always_check]
          Sass::Plugin.update_stylesheets
        end

        call_without_sass(env)
      end
      alias_method :call_without_sass, :call
      alias_method :call, :call_with_sass
    end

  else

    class MerbHandler # :nodoc:
      def process_with_sass(request, response)
        if !Sass::Plugin.checked_for_updates ||
            Sass::Plugin.options[:always_update] || Sass::Plugin.options[:always_check]
          Sass::Plugin.update_stylesheets
        end

        process_without_sass(request, response)
      end
      alias_method :process_without_sass, :process
      alias_method :process, :process_with_sass
    end

  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
gohanlonllc-haml-2.1.0.20080513000000 lib/sass/plugin/merb.rb
gohanlonllc-haml-2.1.0 lib/sass/plugin/merb.rb
haml-edge-2.1.10 lib/sass/plugin/merb.rb
haml-edge-2.1.11 lib/sass/plugin/merb.rb
haml-edge-2.1.12 lib/sass/plugin/merb.rb
haml-edge-2.1.17 lib/sass/plugin/merb.rb
haml-edge-2.1.18 lib/sass/plugin/merb.rb
haml-edge-2.1.20 lib/sass/plugin/merb.rb
haml-edge-2.1.21 lib/sass/plugin/merb.rb
haml-edge-2.1.16 lib/sass/plugin/merb.rb
haml-edge-2.1.13 lib/sass/plugin/merb.rb
haml-edge-2.1.14 lib/sass/plugin/merb.rb
haml-edge-2.1.15 lib/sass/plugin/merb.rb
haml-edge-2.1.19 lib/sass/plugin/merb.rb
haml-edge-2.1.9 lib/sass/plugin/merb.rb
haml-edge-2.1.7 lib/sass/plugin/merb.rb
haml-edge-2.1.8 lib/sass/plugin/merb.rb