Method: Jammit::Controller#package

Defined in:
lib/jammit/controller.rb

#packageObject

The “package” action receives all requests for asset packages that haven’t yet been cached. The package will be built, cached, and gzipped.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/jammit/controller.rb', line 19

def package
  parse_request
  template_ext = Jammit.template_extension.to_sym
  case @extension
  when :js
    render :js => (@contents = Jammit.packager.pack_javascripts(@package))
  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 && (@extension != template_ext)
rescue Jammit::PackageNotFound
  package_not_found
end