Open CdUrna opened 4 years ago
Hi,
I solved this issue by overriding the value of $roboto-font-path
, as shown below:
$roboto-font-path: '~roboto-fontface/fonts'
Hope it helps.
Hi @Sulasdeli,
Can you please provide more info. I've tried your solution and it didn't work (I've put it in styles.scss). Where do we have to override the original path, in app.scss, in styles.scss etc? And where do we have to use the $roboto-font-path
variable?
This is a main blocker as prod build and dev build fails because of the provided error.
Note: Prod serve and dev serve do not fail (only show error at compile time as shown by the author).
Thanks.
Hi @vmuresanu,
I've added this to my styles.scss
:
/* Roboto Font */
$roboto-font-path: '~roboto-fontface/fonts';
@import '~roboto-fontface/css/roboto/sass/roboto-fontface-regular.scss';
@Sulasdeli,
I've added to my styles.scss
the same snippet as you've provided but no luck :(. The error is still there
@vmuresanu
Did you make sure that the style sheet is not included elsewhere in the project (e.g. angular.json
)?
@Sulasdeli yep that's exactly what I was missing. Thanks a lot!!. Now the dev/prod build works. So to summarize:
"input": "node_modules/roboto-fontface/css/roboto/sass/roboto-fontface.scss"
from styles array in angular.json
styles.scss
:
$roboto-font-path: '~roboto-fontface/fonts';
@import '~roboto-fontface/css/roboto/sass/roboto-fontface-regular.scss'; (or/and any other roboto fontface scss files)
Another way to overwrite the default value of '$roboto-font-path' is the use of "@use '...' with (..)" - see the sass website on variables.
Migrating from angular 8 to angular 9 I updated all the scss @imports in my current app to the 'new' syntax using @use (as IMHO this is the way sass recommends by now).
So my import of roboto now looks like:
@use 'roboto-fontface/css/roboto/sass/roboto-fontface' with (
$roboto-font-path: '~roboto-fontface/fonts'
);
I found problem that in Angular 10 this fonts not work properly. In Angular 9 and other older version it works. Error log
angular.json
package.json