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
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.