lib/jammit/controller.rb in jammit-0.5.4 vs lib/jammit/controller.rb in jammit-0.6.0

- old
+ new

@@ -13,19 +13,20 @@ # The "package" action receives all requests for asset packages that haven't # yet been cached. The package will be built, cached, and gzipped. def package parse_request + template_ext = Jammit.template_extension.to_sym case @extension when :js render :js => (@contents = Jammit.packager.pack_javascripts(@package)) - when Jammit.template_extension.to_sym + when template_ext render :js => (@contents = Jammit.packager.pack_templates(@package)) when :css render :text => generate_stylesheets, :content_type => 'text/css' end - cache_package if perform_caching + cache_package if perform_caching && (@extension != template_ext) rescue Jammit::PackageNotFound package_not_found end @@ -85,10 +86,10 @@ end # Make the Jammit::Controller available to Rails as a top-level controller. ::JammitController = Jammit::Controller -if defined?(Rails) && (Rails.env.development? || Rails.env.test?) +if defined?(Rails) && Rails.env.development? ActionController::Base.class_eval do append_before_filter { Jammit.reload! } end end