Skip to content

Generate a service worker to cache resources and make them available offline.

License

Notifications You must be signed in to change notification settings

lukeed/fly-precache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fly-precache

Generate a service worker to cache resources and make them available offline.

Install

npm install --save-dev fly-precache

API

.precache(options)

A full list of sw-precache options can be found here.

Usage

Cache assets within the dist directory. This will create a dist/sw directory that contains two dependencies for the dist/service-worker.js.

exports.cache = function * (fly) {
  yield fly.source('dist/**/*.{js,html,css,png,jpg,gif}')
    .precache({
      cacheId: 'my-project-name'
    })
    .target('dist');
}

License

MIT © Luke Edwards

About

Generate a service worker to cache resources and make them available offline.

Resources

License

Stars

Watchers

Forks

Packages

No packages published