README.md in serviceworker-rails-0.2.0 vs README.md in serviceworker-rails-0.3.0

- old
+ new

@@ -1,13 +1,15 @@ # ServiceWorker::Rails -Integrates ServiceWorker scripts with the Rails asset pipeline. +[![Build Status](https://travis-ci.org/rossta/serviceworker-rails.svg?branch=master)](https://travis-ci.org/rossta/serviceworker-rails) +Use [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) with the Rails asset pipeline. + ## Features -* Leverages Rails asset pipeline to compile service worker scripts -* Adds appropriate response headers to service worker scripts +* Maps service worker endpoints to Rails assets +* Adds appropriate response headers to service workers * Renders compiled source in production and development ## Installation Add this line to your application's Gemfile: @@ -33,27 +35,23 @@ ```ruby # application.rb config.serviceworker.routes.draw do - get "/basic-serviceworker.js" + match "/basic-serviceworker.js" - get "/proxied-serviceworker.js" - asset: "nested/asset/serviceworker.js" + match "/proxied-serviceworker.js" => "nested/asset/serviceworker.js" - get "/nested/serviceworker.js", - asset: "another/serviceworker.js" + match "/nested/serviceworker.js" => "another/serviceworker.js" - get "/header-serviceworker.js", - asset: "another/serviceworker.js", + match "/header-serviceworker.js" => "another/serviceworker.js", headers: { "X-Resource-Header" => "A resource" } - get "/*/serviceworker.js", - asset: "serviceworker.js" + match "/*/serviceworker.js" => "serviceworker.js" end ``` -`Serviceworker-Rails` with insert a `Cache-Control` header to instruct browsers +`Serviceworker::Rails` with insert a `Cache-Control` header to instruct browsers not to cache your serviceworkers by default. You can customize the headers for all service worker routes if you'd like, such as adding the experimental [`Service-Worker-Allowed`](https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#service-worker-allowed) header to set the allowed scope. ```ruby config.serviceworker.headers["Service-Worker-Allowed"] = "/"