Permalink
Browse files

Merge pull request #25 from jzinedine/master

add sample code snippet on how to use it with Rails asset pipeline
  • Loading branch information...
2 parents 5db8861 + dbc6b06 commit 355b2ecd88667857b26852a84a297c60fed7fc2d @wycats committed Feb 26, 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 355b2ec

Please sign in to comment.