Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mutsuntsai/gulp-workbox


https://github.com/mutsuntsai/gulp-workbox

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# gulp-workbox

> Gulp plugin for injecting workbox manifest.

This plugin is especially useful if you need to build the `sw.js` first (perhaps by TypeScript) and then inject the manifest in a single flow.

## License

MIT © Mu-Tsun Tsai 2021

## Install

```bash
npm install workbox-build gulp-workbox -save-dev
```

Notice that [workbox-build](https://www.npmjs.com/package/workbox-build) is deliberately installed separately.

## Usage

```javascript
var gulp = require('gulp');
var workbox = require('gulp-workbox');

gulp.task('build', () =>
gulp.src('src/sw.js')
.pipe(workbox({
globDirectory: 'dist',
globPatterns: [
'**/*.htm',
'**/*.js',
'**/*.css',
],
globIgnores: ['sw.js']
}))
.pipe(gulp.dest('dist'))
);
```

The options are the same as those of the [`getManifest()`](https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-build#.getManifest) method, plus an optional string `injectionPoint` (whose default value is `"self.__WB_MANIFEST"`);