How to bundle vendor fonts when creating libraries with Angular cli
You should add primeicons
as a peerDependency
and then in the other project you should add in the angular.json
the styles configuration.
"styles": [
"node_modules/primeicons/primeicons.css",
],
After that you already have it imported so it doesn't need the import
from my-lib-playground/src/styles.scss
anymore.
PrimeNG has that example on the readme of the github. https://github.com/primefaces/primeng
The library project does not have a root directory, root directory always depends on project root where the library is consuming.
so either you have to import fonts into the main project, I know this you already tried,
so, the only option is to convert the font into base64 and assign into CSS.
convert font file to base64 - https://www.giftofspeed.com/base64-encoder/
declare font in CSS
@font-face {
font-family: 'myfont';
src: url(data:font/truetype;charset=utf-8;base64,<BASE64-STRING>) format('truetype');
}