The easiest way to use Rack::Offline is by using Rails::Offline in a Rails application.
In your router:
match "/application.manifest" => Rails::Offline
This will automatically cache all JavaScript, CSS, and HTML in your public
directory, and will cause the cache to be updated each request in development
mode.
You can fine-tune the behavior of Rack::Offline by using it directly:
offline = Rack::Offline.configure do
cache "images/masthead.png"
public_path = Rails.public_path
Dir[public_path.join("javascripts/*.js")].each do |file|
cache file.relative_path_from(public_path)
end
network "/"
end
https://github.com/wycats/rack-offline
No comments:
Post a Comment