Service Worker

‹ Back


Note: Ornament does not come with a service worker out of the box. If you wish to utilise service workers you will need to create a service worker.

The simplest way to do this is to create a service-worker.js file in your public directory.

Local development

Due to local development often resulting in service workers being registered and then continued to be used when switching to a different local rails application, you must opt-in to use local service workers. You can do so by executing the following code in your javascript console:


To opt-out again later on, simply run this code:


Once opted-out, you will need to unregister your service workers, which can be done in Chrome under the "application" tab in the developer tools.

Disabling service workers

Service workers can be disabled entirely by opening up application.js and disabling the require statement for the service worker code: //= require ornament/register-service-worker