Continuous delivery is great, but it comes at a price on performances. The more you deliver, the less browsers will use assets they had in cache, because of file versionning. Even if you only changed one letter in a file, it will get downloaded entirely.
Service Workers to the rescue
sw-delta is a project that makes the browser download only the delta ( = diff = incremental download) between the previously cached file and the required version of the file. It is based on the Service Worker API.
How does it work?
Client-side: a Service Worker intercepts every outgoing request. If the url matches one of the configured routes, than the Service Worker will compare the requested version with the version stored in cache. If an update is needed, the Service Worker will update the url to add the known version as a querystring, like this:
Asked url: http://domain.com/js/main-1.2.0.js
Version in cache:
Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/8Ifpbgf8vHI/sw-delta