diff --git a/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts b/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts index aebffd76019a..3d7a3cc245b5 100644 --- a/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts +++ b/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts @@ -161,10 +161,10 @@ export class InlineFontsProcessor { if (this.options.minifyInlinedCSS) { cssContent = cssContent + // Comments. + .replace(/\/\*([\s\S]*?)\*\//g, '') // New lines. .replace(/\n/g, '') - // Comments and new lines. - .replace(/\/\*\s.+\s\*\//g, '') // Safe spaces. .replace(/\s?[\{\:\;]\s+/g, s => s.trim()); } diff --git a/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts_spec.ts b/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts_spec.ts index dbf04237ed35..10c91fc6bd62 100644 --- a/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts_spec.ts +++ b/packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts_spec.ts @@ -39,6 +39,27 @@ describe('InlineFontsProcessor', () => { expect(html).toContain(`font-family: 'Material Icons'`); }); + it('should inline multiple fonts from a single request with minification enabled', async () => { + const inlineFontsProcessor = new InlineFontsProcessor({ + minifyInlinedCSS: true, + WOFFSupportNeeded: false, + }); + + const html = await inlineFontsProcessor.process(` + +
+ + + + + `); + + expect(html).toContain(`'Google Sans'`); + expect(html).toContain(`'Roboto'`); + expect(html).toContain(`'Roboto Mono'`); + expect(html).toContain(`'Material Icons'`); + }); + it('works with http protocol', async () => { const inlineFontsProcessor = new InlineFontsProcessor({ WOFFSupportNeeded: false,