-
Notifications
You must be signed in to change notification settings - Fork 12k
1.7.0 fonts are corrupted after prod build #9648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
same issue on build and on ng serve got error |
I tried reproducing on Windows with 1.7.0 and could not. This is what I did:
|
ng serve is fine for me, the error occurs when I run |
Tried a production build |
I didn't try this guy's build, but I see these same errors using The issues started in 1.7.0-beta3 for me. Please let me know if you guys need any more info - this one is blocking me from upgrading (along with #9651) so I'd be glad to provide whatever info would help. |
@MattMorrisDev That was caused by a bug in the betas that was fixed for the final release via #9564 . The issue occurring here appears to be due to an interaction with nginx/apache. |
Sorry, you're right. Got my versions/bugs mixed up. |
This may be due to a caching issue. An old corrupt version of the file could either be cached local in the browser or in some intermediate cache. |
Not related to caching, I always build a new docker container on deploy, and when I make it with 1.6.8 everything is fine, with 1.7.0 always messed up. On my work PC caching in disabled in the browser. |
Seeing the same, moving back to 1.6.8. I also build a new container each time on ubuntu. So not related to caching or windows or mac. |
As we are unable to reproduce this, can you possibly put together a minimal reproduction that demonstrates the problem. Also, does this occur with ng serve in production mode? Something else to try would be to do a production build and then use live-server (or similar) to test locally and reduce the complexity of the test case. |
|
@andjiev That's not related to this issue as the fonts in that case would not be processed by the CLI as it is an absolute URL. This issue may be more relevant: #9267. Also see my comment from that issue on why loading fonts in that manner is generally not a good idea: #9267 (comment) |
Items that "might" help on repro. I am sorry I cannot easily break down the app, which is both large and proprietary.
Build is
|
Note on above when failing the angular cli version in package.json was |
Same problem for me but with version 1.7.1, everything is fine with version 1.7.0. Versions Angular CLI: 1.7.1 @angular/cli: 1.7.1 |
Same problem with
1.7.0 works just fine when running |
Can confirm on 1.7.* when "ng build --prod" is served through nginx. As above, clean docker image each time so definitely no caching issue. Reverting to 1.6.8 resolves. |
Hmm I'm having a strange issue with fonts too since upgrading to 1.7.2 from 1.6.8, when I run --prod build my font imports seem to just disappear, I have moved them to index.html to get them working again, the strange thing is that it's only happening in one branch and I can't see any differences of note between the branches that would cause this, I haven't looked into it too much yet but it occurs running ng serve --prod as well as ng build --prod then using http-server to serve. |
I'm experiencing similar issue after migrating from 1.6.8 to 1.7.3. Steps to reproduce:
Download any font as a sample and put it into the project directory. I'll use Font Awesome as example. Then manually add @font-face definition to styles.css: @font-face {
font-family: "Font Awesome";
src: url("./fa-solid-900.woff2") format("woff2");
font-weight: normal;
font-style: normal;
}
body {
font: "Font Awesome";
} Then try to build the project:
Fonts will not work, because they are removed from the output bundle. If I just downgrade @angular/cli to 1.6.8 in the same project without applying any changes to project and build it in the prod mode it's working fine. |
I'm facing this issue too. But is weird because in my case the icons shows partially, just a couple of them are not being rendered and the worst part is that my images are not being rendered in any way and the console doesn't show any issue related with the images. Also, when I run |
@anton-gorbikov Did you ever find a solution to this? I'm getting the "Invalid font values" warning as well, except I'm not even sure what fonts it is affecting, I'm assuming font awesome. |
@bluecaret No, I have no solution/workaround for this issue. In my current project it affects all fonts, not just Font Awesome. So I just rolled back |
Just tried with 1.7.4 (released 2 days ago) - issue is still present. |
I had this problem in combination with nginx. When I added the following line to server part in nginx configuartion file it was resolved: |
I am seeing this too. Angular CLI: 1.7.4 Running: WARNING in Invalid font values at 1405:2. Ignoring. |
I can confirm this too. If I build with angular/cli 1.6.8, everything is fine. Currently I have to use angular/[email protected] to build and publish. Hopefully update to angular/cli will fix the issue |
I have the same issues after renaming my font from "MyFont" to "My Font" After using the seperate styles "font-family", "font-size"... it works again. With the "font" shortcut property it fails. |
Of course it has something to do with the space. Have you read anything in this thread? |
Why so rude? Here are several ideas and comments to this problem. I have not seen/read your comment on that. |
|
I have same warning. I add my fonts in main styles.scss and use this fonts in scss files All work fine, but this warning infuriates me. ` Package Version@angular-devkit/architect 0.13.5 |
Just remove the spaces from the font's filename. |
Hi all, There seems to be several issues being mentioned in the report, I will go though them a bit in detail here. Filenames with spaces Font names with spaces Both issues will be addressed in this PR #13903 If you are experiencing any other issues, kindly file a new issue with a minimal reproduction. |
At the moment the uri of the font instead of spaced it will be `%20`, hence we need to decode it first before trying to resolve it. Fixes #9648
…thand is used At the moment when `font` shorthand property is used a warning is emitted when using this syntax ``` font: 10px "Font Awesome"; ``` This should be addressed by clean-css Fixes #9648
Clean-css issue clean-css/clean-css#1063 |
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. |
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:
and then I use this in font definition:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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
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
The text was updated successfully, but these errors were encountered: