Permalink
Browse files

add sample code snippet on how to use it with Rails asset pipeline

  • Loading branch information...
1 parent 5db8861 commit dbc6b06f4b10ee23fafa45cc74884a93db21be7f @jzinedine jzinedine committed Jan 17, 2013
Showing with 15 additions and 1 deletion.
  1. +15 −1 README.textile
View
@@ -30,6 +30,20 @@ offline = Rack::Offline.configure do
end
</pre>
+And when used with Rails asset pipeline:
+
+<pre lang="ruby">
+ 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")
+ # cache other assets
+ network "/"
+ end
+ match "/application.manifest" => offline
+ end
+</pre>
+
You can pass an options Hash into #configure in Rack::Offline:
|_. name |_. purpose |_. value in Rails::Offline |
@@ -208,4 +222,4 @@ jQuery(function($) {
// If the user is online, ask for updates now
if(window.navigator.onLine) remoteUpdate();
})
-</pre>
+</pre>

0 comments on commit dbc6b06

Please sign in to comment.