Skip to content

Commit a7b2e6f

Browse files
committed
feat(@schematics/angular): update ngsw-config resources extensions
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
1 parent 69626e3 commit a7b2e6f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/angular_devkit/build_angular/src/builders/browser/specs/service-worker_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Browser Builder service worker', () => {
2727
installMode: 'lazy',
2828
updateMode: 'prefetch',
2929
resources: {
30-
files: ['/assets/**', '/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)'],
30+
files: ['/assets/**', '/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)'],
3131
},
3232
},
3333
],

packages/schematics/angular/service-worker/files/ngsw-config.json.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"resources": {
2323
"files": [
2424
"/assets/**",
25-
"<%= resourcesOutputPath %>/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
25+
"<%= resourcesOutputPath %>/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
2626
]
2727
}
2828
}

packages/schematics/angular/service-worker/index_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ describe('Service Worker Schematic', () => {
225225
const pkgText = tree.readContent('/projects/bar/ngsw-config.json');
226226
const config = JSON.parse(pkgText);
227227
expect(config.assetGroups[1].resources.files).toContain(
228-
'/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)',
228+
'/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)',
229229
);
230230
});
231231

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

0 commit comments

Comments
 (0)