Skip to content

japrescott/grunt-sw-precache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

grunt-sw-precache

This is a fork of the grunt-sw-precache by Morris Allison. It contains recent changes to sw-precache and supports options like runtimeCache

A Grunt task for generating service workers using sw-precache.

npm Version MIT License

Getting Started

grunt-sw-precache requires Grunt ~0.4.5.

If you haven't used Grunt before, please view the Getting Started guide. The guide explains how to create a Gruntfile, and how to install and use Grunt plugins.

Installation

if you want to use this fork of grunt-sw-precache, directly refer to this repo japrescott/grunt-sw-precache.git within your package.json

Configuration

The options documented here are specific to grunt-sw-precache.

For all other options, please view the options documentation for sw-precache.

baseDir string

The base directory for the staticFileGlobs and workerFileName options.

Default is "./dist";

workerFileName string

The file name of the generated service worker. This is joined with the baseDir option.

Default is "service-worker.js";

appendTimestamp boolean

If true, a comment containing a human readable UTC timestamp will be appended to the service worker.

/* @preserve Thu, 01 Jan 1970 00:00:00 GMT */

Default is true;

stripPrefix string

The same option as stripPrefix in sw-precache, but has a different default value.

Default is baseDir + '/';

Example

grunt.initConfig({
	'sw-precache': {
		options: {
			cacheId: 'your-package-name',
			workerFileName: 'sw.js',
			verbose: true,
		},
		'default': {
			staticFileGlobs: [
				'css/**/*.css',
				'font/**/*.{woff,ttf,svg,eot}',
				'img/**/*.{gif,png,jpg}',
				'js/**/*.js',
			],
		},
		'develop': {
			staticFileGlobs: [
				'font/**/*.{woff,ttf,svg,eot}'
			],
		},
	},
});

License

Released under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published