From 7ce70d533465a9ec7c9afee4888b9d99e78a615e Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 13 May 2010 23:22:41 -0700 Subject: [PATCH] [Sass] Make Merb work. Really. Closes gh-163 --- doc-src/SASS_CHANGELOG.md | 7 +++++++ lib/sass/plugin/merb.rb | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index 7be33bde..69bbff1a 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -5,6 +5,13 @@ ## 3.0.3 (Unreleased) +### Merb Support + +Merb, including 1.1.0 as well as earlier versions, +should *really* work with this release. + +### Bug Fixes + * Raise an informative error when mixin arguments have a mispaced comma, as in `@include foo(bar, )`. diff --git a/lib/sass/plugin/merb.rb b/lib/sass/plugin/merb.rb index 00801d60..c5724b84 100644 --- a/lib/sass/plugin/merb.rb +++ b/lib/sass/plugin/merb.rb @@ -25,6 +25,13 @@ unless defined?(Sass::MERB_LOADED) Sass::Plugin.options.merge!(config) require 'sass/plugin/rack' - # Merb::Config is used in Merb >= 1.1.0 - (Merb::Config[:app] || Merb::Config).use Sass::Plugin::Rack + class Sass::Plugin::MerbBootLoader < Merb::BootLoader + after Merb::BootLoader::RackUpApplication + + def self.run + # Apparently there's no better way than this to add Sass + # to Merb's Rack stack. + Merb::Config[:app] = Sass::Plugin::Rack.new(Merb::Config[:app]) + end + end end