Tweaked a little and pushed. Thanks a lot. - Nathan
Brian Johnson wrote: > The reason I used Merb::Rack::Application#call because thats were > static content gets handled. If it wraps Merb::Dispatcher#handle and > you use page caching or someone request the style sheet directly it > would be possible to end up with an out of date style sheet. > > Also heres the pastie version of the patch. > > http://pastie.caboo.se/151969 > > On Feb 13, 9:56 pm, Nick <[EMAIL PROTECTED]> wrote: > >> This patch looks like a good fix. I'm curious though. Should the >> call that runs the sass plugin be in Merb::Rack::Application#call or >> should it be in the Merb::Dispatcher#handle. My only thinking is that >> if something goes wrong in the handle then >> Merb::Rack::Application#call has a chance to rescue and display 500 >> error. Not sure if this is a concern or not. >> >> see my pastie as the two varitions (one from the posted patch from >> Brian) and another spot it could possibly go. >> >> http://pastie.caboo.se/151938 >> >> On Feb 13, 7:31 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote: >> >> >>> Thanks, but please don't send git patches through Google Groups. It can >>> mangle them and add footers. Pastie it or email it directly. >>> >>> Also, please use git format-patch to preserve your commit message and >>> authorship. >>> >>> - Nathan >>> >>> Brian Johnson wrote: >>> >>>> --- >>>> lib/sass/plugin/merb.rb | 36 ++++++++++++++++++++++++++++-------- >>>> 1 files changed, 28 insertions(+), 8 deletions(-) >>>> >>>> diff --git a/lib/sass/plugin/merb.rb b/lib/sass/plugin/merb.rb >>>> index 9a7263e..e09b66c 100644 >>>> --- a/lib/sass/plugin/merb.rb >>>> +++ b/lib/sass/plugin/merb.rb >>>> @@ -18,16 +18,36 @@ unless defined?(Sass::MERB_LOADED) >>>> config.symbolize_keys! >>>> Sass::Plugin.options.merge!(config) >>>> >>>> - 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 >>>> + if version[0] > 0 || (version[0] <= 0 && version[1] >= 9) >>>> + >>>> + class Merb::Rack::Application # :nodoc: >>>> + def sass_handler(env) >>>> + if !Sass::Plugin.checked_for_updates || >>>> + Sass::Plugin.options[:always_update] || >>>> Sass::Plugin.options[:always_check] >>>> + Sass::Plugin.update_stylesheets >>>> + end >>>> + >>>> + orginal_handler(env) >>>> end >>>> + alias_method :orginal_handler, :call >>>> + alias_method :call, :sass_handler >>>> + end >>>> + >>>> + else >>>> >>>> - process_without_sass(request, response) >>>> + class MerbHandler # :nodoc: >>>> + def sass_handler(request, response) >>>> + if !Sass::Plugin.checked_for_updates || >>>> + Sass::Plugin.options[:always_update] || >>>> Sass::Plugin.options[:always_check] >>>> + Sass::Plugin.update_stylesheets >>>> + end >>>> + >>>> + orginal_handler(request, response) >>>> + end >>>> + alias_method :orginal_handler, :process >>>> + alias_method :process, :sass_handler >>>> end >>>> - alias_method :process_without_sass, :process >>>> - alias_method :process, :process_with_sass >>>> + >>>> end >>>> + >>>> end >>>> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
