lib/localtower/engine.rb in localtower-1.0.0 vs lib/localtower/engine.rb in localtower-2.0.0
- old
+ new
@@ -1,9 +1,12 @@
module Localtower
class Engine < ::Rails::Engine
isolate_namespace Localtower
- initializer 'static assets' do |app|
- app.middleware.use ::ActionDispatch::Static, "#{root}/public"
+ initializer 'localtower.add_static_assets', before: :build_middleware_stack do |app|
+ app.config.middleware.use Rack::Deflater
+ app.config.middleware.use ::ActionDispatch::Static, "#{root}/public"
+ # Later: have a better assets pipeline to be able to version and cache assets forever
+ # app.config.middleware.use ::ActionDispatch::Static, "#{root}/public", headers: { "Cache-Control" => "public, max-age=31536000" }
end
end
end