New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-sw-precache

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-sw-precache

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

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
61
increased by1.67%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-sw-precache

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

grunt-sw-precache can be installed using the following command:

$ npm install grunt-sw-precache --save-dev

To enable grunt-sw-precache, add the following line to your Gruntfile:

grunt.loadNpmTasks('grunt-sw-precache');

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.

Keywords

FAQs

Package last updated on 16 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc