lib/rack/less/request.rb in rack-less-0.1.0 vs lib/rack/less/request.rb in rack-less-1.0.0

- old
+ new

@@ -26,11 +26,14 @@ def path_info @env['PATH_INFO'] end - # TODO: test these + def http_accept + @env['HTTP_ACCEPT'] + end + def path_resource_name path_info =~ CSS_PATH_REGEX ? path_info.match(CSS_PATH_REGEX)[1] : nil end def path_resource_format @@ -46,18 +49,18 @@ nil end source_opts = { :folder => File.join(options(:root), options(:source)), :cache => cache, - :compress => options(:compress), - :combine => options(:combine) + :compress => options(:compress) } Source.new(path_resource_name, source_opts) end end def for_css? - media_type == Rack::Less::MEDIA_TYPE || + (http_accept && http_accept.include?(Rack::Less::MIME_TYPE)) || + (media_type && media_type.include?(Rack::Less::MIME_TYPE )) || CSS_PATH_FORMATS.include?(path_resource_format) end # Determine if the request is for existing LESS CSS file # This will be called on every request so speed is an issue