-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (35 loc) · 1.16 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const gulp = require('gulp');
const gulpHelper = require('@littleware/little-nodedev/gulpHelper');
const basePath = "src/@littleware/little-elements";
const workboxBuild = require('workbox-build');
const buildSW = () => {
// This will return a Promise
return workboxBuild.generateSW({
swDest: 'web/lib/appContext/service-worker.js',
// Define runtime caching rules.
runtimeCaching: [{
// Match any request that ends with .js, .css, .html, or .svg.
urlPattern: /\.(?:js|css|html|svg)$/,
// Apply a cache-first strategy.
handler: 'CacheFirst',
options: {
// Use a custom cache name.
cacheName: 'assets',
/* Only cache 10 images.
expiration: {
maxEntries: 10,
}, */
},
}],
});
};
gulpHelper.defineTasks(gulp, { basePath });
gulp.task('service-worker', () => {
return buildSW();
});
gulp.task('default', gulp.series('little-compile', 'service-worker', (done) => {
// place code for your default task here
//console.log( "Hello, World!" );
//gulp.src( "src/**/*" ).pipe( gulp.dest( "lib/" ) );
done();
}));