2007-11-17 19:55:26 +00:00
|
|
|
unless defined?(Sass::MERB_LOADED)
|
|
|
|
Sass::MERB_LOADED = true
|
|
|
|
|
2008-01-10 23:16:12 +00:00
|
|
|
version = Merb::VERSION.split('.').map { |n| n.to_i }
|
|
|
|
if version[0] <= 0 && version[1] < 5
|
|
|
|
root = MERB_ROOT
|
|
|
|
env = MERB_ENV
|
|
|
|
else
|
2008-08-03 19:28:06 -04:00
|
|
|
root = Merb.root.to_s
|
2008-01-10 23:16:12 +00:00
|
|
|
env = Merb.environment
|
|
|
|
end
|
|
|
|
|
2009-04-22 13:12:32 -07:00
|
|
|
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")
|
2007-11-17 19:55:26 +00:00
|
|
|
config = Merb::Plugins.config[:sass] || Merb::Plugins.config["sass"] || {}
|
2008-04-07 23:09:17 -07:00
|
|
|
|
2008-03-13 08:24:48 -04:00
|
|
|
if defined? config.symbolize_keys!
|
|
|
|
config.symbolize_keys!
|
|
|
|
end
|
|
|
|
|
2007-11-17 19:55:26 +00:00
|
|
|
Sass::Plugin.options.merge!(config)
|
2008-04-07 23:09:17 -07:00
|
|
|
|
2008-02-13 16:40:24 -05:00
|
|
|
if version[0] > 0 || version[1] >= 9
|
|
|
|
|
2009-04-25 15:58:42 -07:00
|
|
|
class Merb::Rack::Application
|
2008-02-13 16:40:24 -05:00
|
|
|
def call_with_sass(env)
|
2009-11-09 17:16:59 -08:00
|
|
|
Sass::Plugin.check_for_updates
|
2008-02-13 16:40:24 -05:00
|
|
|
call_without_sass(env)
|
2008-02-11 19:49:16 -08:00
|
|
|
end
|
2008-02-13 16:40:24 -05:00
|
|
|
alias_method :call_without_sass, :call
|
|
|
|
alias_method :call, :call_with_sass
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2009-04-25 15:58:42 -07:00
|
|
|
class MerbHandler
|
2008-02-13 16:40:24 -05:00
|
|
|
def process_with_sass(request, response)
|
2009-11-09 17:16:59 -08:00
|
|
|
Sass::Plugin.check_for_updates
|
2008-02-13 16:40:24 -05:00
|
|
|
process_without_sass(request, response)
|
|
|
|
end
|
|
|
|
alias_method :process_without_sass, :process
|
|
|
|
alias_method :process, :process_with_sass
|
2007-11-17 19:55:26 +00:00
|
|
|
end
|
2008-02-13 16:40:24 -05:00
|
|
|
|
2007-11-17 19:55:26 +00:00
|
|
|
end
|
|
|
|
end
|