angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

1.7.0 fonts are corrupted after prod build

Open MateEke opened this issue 8 years ago • 64 comments

Versions

Angular CLI: 1.7.0 Node: 8.9.1 OS: win32 x64 Angular: 5.2.5 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

@angular/cli: 1.7.0 @angular-devkit/build-optimizer: 0.3.1 @angular-devkit/core: 0.3.1 @angular-devkit/schematics: 0.3.1 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.0 @schematics/angular: 0.3.1 @schematics/package-update: 0.3.1 typescript: 2.7.1 webpack: 3.11.0

Repro steps

  • Install @angular/cli: 1.7.0
  • import fontawesome in .angular-cli.json or in styles.scss
  • run ng build --prod

Observed behavior

Failed to decode downloaded font: http://***/fontawesome-webfont.af7ae505a9eed503f8b8.woff2?v=4.7.0 OTS parsing error: invalid version tag

Desired behavior

FontAwesome icons works fine

Mention any other details that might be useful (optional)

With cli 1.6.8 everything is OK

MateEke avatar Feb 16 '18 10:02 MateEke

Clean-css issue https://github.com/jakubpawlowicz/clean-css/issues/1063

alan-agius4 avatar Mar 14 '19 08:03 alan-agius4

I was also getting the same error after using --prod flag. Removing the space in the font name in @font-face rectified the issue for me.

safalpillai avatar Mar 18 '19 08:03 safalpillai

Found a workaround for the issue with space in font name:

as in CSS standard, enclose the font name in double quotes, and add a generic fallback. For me, it gives:

$regular-font: '"Open Sans", sans-serif';

and then I use this in font definition:

mat-typography-config( $font-family: $regular-font, /*...*/)

qortex avatar Apr 04 '19 14:04 qortex

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.