2013-01-16 36 views
0

下面是相关的源代码:HTML5离线功能不Heroku的服务器上运行

offline = Rack::Offline.configure :cache_interval => 120 do  
Rails.application.assets.each_logical_path.select{|e| not e.include? ".pdf"}. 
    each {|e| cache "assets/" + e} 
network "/" 
end 
match "/application.manifest" => offline 

生成manifest似乎罚款,资产过,但它会停止下载/缓存资产在Chrome浏览器随机发送此消息:https://muster-apotheke.splettville.com/application.manifest

欣赏任何帮助。

回答

2

通过使用asset_path helper方法,可以参考我的生产资产缓存清单:

if Rails.env.production? 
    offline = Rack::Offline.configure :cache_interval => 120 do  
     cache ActionController::Base.helpers.asset_path("application.css") 
     cache ActionController::Base.helpers.asset_path("application.js") 
     network "/" 
    end 
    match "/application.manifest" => offline 
    else 
    offline = Rack::Offline.configure :cache_interval => 120 do  
     Rails.application.assets.each_logical_path.select{|e| not e.include? ".pdf"}.each {|e| cache "assets/" + e} 
     network "/" 
    end  
    match "/application.manifest" => offline 
    end 
相关问题