Skip to content

Commit

Permalink
feat(@schematics/angular): update ngsw-config resources extensions
Browse files Browse the repository at this point in the history
With this change we update service worker ngsw-config resources extensions.

- Remove `eot`. Old IE font format. Not supported by browsers which support service worker.
- Remove `ani`. Not supported by browsers.
- Add `jpeg` as common alias for `jpg`.
- Add `apng` as modern alternative to `gif`.
- Add `avif` a modern image format.

Closes #21526
  • Loading branch information
alan-agius4 committed Aug 9, 2021
1 parent 69626e3 commit a7b2e6f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -27,7 +27,7 @@ describe('Browser Builder service worker', () => {
installMode: 'lazy',
updateMode: 'prefetch',
resources: {
files: ['/assets/**', '/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)'],
files: ['/assets/**', '/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)'],
},
},
],
Expand Down
Expand Up @@ -22,7 +22,7 @@
"resources": {
"files": [
"/assets/**",
"<%= resourcesOutputPath %>/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
"<%= resourcesOutputPath %>/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/schematics/angular/service-worker/index_spec.ts
Expand Up @@ -225,7 +225,7 @@ describe('Service Worker Schematic', () => {
const pkgText = tree.readContent('/projects/bar/ngsw-config.json');
const config = JSON.parse(pkgText);
expect(config.assetGroups[1].resources.files).toContain(
'/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)',
'/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)',
);
});

Expand All @@ -239,7 +239,7 @@ describe('Service Worker Schematic', () => {
const pkgText = tree.readContent('/projects/bar/ngsw-config.json');
const ngswConfig = JSON.parse(pkgText);
expect(ngswConfig.assetGroups[1].resources.files).toContain(
'/outDir/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)',
'/outDir/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)',
);
});

Expand Down

0 comments on commit a7b2e6f

Please sign in to comment.