0.1.5 • Published 9 years ago
gulp-sw-cache v0.1.5
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-devThen, 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'))
});