Reputation: 480
I read many tutorials about sw-toolbox and sw-precache. The doubt i am having is :
When reading about sw-precache, i found out most tutorials are using gulp + sw-precache
.
Whereas in sw-toolbox
case, i saw the example and syntaxes given only for writing code in service-worker.js
directly (no gulpfile code).
I am using gulp to automatically generate service-worker
file .
So my main concern is to write code for sw-toolbox
in gulp file directly so that i need not write sw-toolbox
code after generating sw-precache
with gulp
Please comment for doubts
Upvotes: 2
Views: 478
Reputation: 156
You no need to write separate code manually for sw-toolbox
. You can configure it using runtimeCaching
option in sw-precache
. As soon as you configured this option, sw-precache
will insert sw-toolbox
library in serviceWorker and adds different handlers to it. You can find more details from this link.
Upvotes: 4
Reputation: 9821
When using sw-precache it generates the service worker and you can't edit that file.
When using sw-precache I'd ignore sw-toolbox and just focus on how to configure sw-precache to cache static files and cache runtime files (I.e. cache images or pages as they are requested)
Upvotes: -2