0.1.5 • Published 8 years ago

gulp-sw-cache v0.1.5

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

gulp-sw-cache

Add Offline Cache for WebApp. Submitted by Hom Yan

Usage

First, install gulp-sw-cache as a dev dependency

npm install gulp-sw-cache --save-dev

Then, include sw.controller.js in html, and add below to register serviceWorker.

if(condition) new SwController()

API

Parameters

sw(options)

This controls how this task (and its helpers) operate and should contain key:value pairs, see options below.

options.versionPrefix

Type: String
Default: sw

Add a cache version prefix.

options.exclude

Type: String Array
Default: undefined

Exclude specific files from the Cache file list.

Usage Example

  gulp.task('offline', function() {
    gulp.src(path.join('src', '/**/*'))
      .pipe(sw({
        exclude: ['index.html'],
        versionPrefix: 'test'
      }))
      .pipe(gulp.dest('dist'))
  });