jekyll plugin to use service workers and make site content available offline
Switch branches/tags
Nothing to show
Clone or download
Latest commit 9d55669 Oct 20, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Initial up Aug 19, 2016
lib Remove debugging code Aug 21, 2016
.gitignore Initial up Aug 19, 2016
CODE_OF_CONDUCT.md Initial up Aug 19, 2016
Gemfile Initial up Aug 19, 2016
LICENSE.txt Initial up Aug 19, 2016
README.md Update README.md Aug 21, 2016
Rakefile Initial up Aug 19, 2016
jekyll-offline.gemspec Add gemspec descriptions and url Aug 19, 2016

README.md

jekyll-offline

ruby gem/jekyll plugin to use service workers and make site content available offline. When visitors load a site, the service worker will be registered and cache content on their device, enabling people to read the content offline/without a network connection.

Many thanks to @gauntface and @jakearchibald for two great resources on Service Workers:

Installation

Add this line to your application's Gemfile:

group 'jekyll-plugins' do
  gem 'jekyll-offline', :git => 'git://github.com/jeremiak/jekyll-offline.git'
end

And add this to your _config.yml:

gems: ['jekyll-offline']

And then execute:

$ bundle install

Usage

The plugin does most of the work for you, but you have to initialize the service worker on the page with the {% register_service_worker %} liquid tag. It is generally a good idea to put this near the bottom of your default layout so that all pages have it.

You can use a variety of strategies to respond to requests. These strategies were pulled from the offline cookbook with minimal changes.

Configure jekyll-offline to use a given strategy by adding the following to your _config.yml:

...
offline:
  strategy: << whatever you want >>

You can supply the following options as the value for strategy:

  • cache-only
  • network-only
  • cache-first-network-fallback
  • network-first-cache-fallback
  • cache-network-race
  • cache-then-network (default)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-offline. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.