My PR in Angular repo has been accepted and merged, so this feature is now directly available in Angular >= 8.0.0-beta.7. This lib is only useful in Angular 6 or 7.
- Angular schematics extension for VS Code (GUI for Angular CLI commands)
- @ngx-pwa/local-storage: 1st Angular library for local storage
- Popular Angular posts on Medium
- Follow updates of this lib on Twitter
- Angular onsite trainings (based in Paris, so the website is in French, but my English bio is here and I'm open to travel)
@angular/service-worker
is a very powerful tool to build Progressive Web Apps.
The default service worker configuration file (ngsw-config.json
) generated by the Angular CLI
(either via ng add @angular/pwa
or ng g service-worker
) already takes care of saving permanently the static files of your application
(index.html
, JavaScript files...).
But you can go a lot further by adding dataGroups
to save temporarily dynamic data (for example,
your API calls, including images), which would be too big for localStorage
or too difficult via indexedDB
.
The official documentation explains it all,
but as the ngsw-config.json
file doesn't have a JSON schema,
you don't get any assistance, and worse, mistakes are not always catched by the building system,
so you could end up with errors in your production build.
So this lib is just the missing JSON schema for ngsw-config.json
for productivity:
- assistance,
- no more errors!
Install the lib (as a dev dependency):
npm install @ngx-pwa/ngsw-schema -D
Now you just have to add it to your ngsw-config.json
file (of course, adapt the path to your case):
{
"$schema": "../node_modules/@ngx-pwa/ngsw-schema/schema.json"
}
MIT