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
StencilJS Custom Fonts not working #2072
Comments
Sorry to bring bad news but as far as I know, there's currently no way to load custom fonts at all from within a shadow DOM. If you want to hack around the issue you can inject the required css into the Chrome bug report https://bugs.chromium.org/p/chromium/issues/detail?id=336876 |
hi, any work arounds for this |
You can dynamically inject your CSS into the
|
how to include google fonts here now, limited to particular web component? any help please? :( Update: @richrd it worked! tysm |
There seems to be another workaround: Basically, you put the same |
load from shadow dom as per ionic-team/stencil#2072 also removes requirement for parent applications to load google fonts separately
By the way this is not a StencilJS bug but for me those solutions work flawless. I wrote a detailed solution here: |
@richrd , This workaround : #2072 (comment), also works only if |
Thanks @ChrisMeye for this in depth solution, I will raise a PR for the Stencil docs to provide more guidance for our general audience. |
It looks like Stencil already recommends using global styles for things like:
@ChrisMeye it seems like this matches what you have outlined in Option 1. In what circumstances are Option 2 and Option 3 better alternatives than using global styles? Any feedback would be appreciated! |
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out. Thank you for using Stencil! |
Stencil version:
I'm submitting a:
[x] bug report
[ ] feature request
[] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
Importing a custom font with the path: url(assets/fonts/FONTNAME.woff) However the Font Family does not appear. It seems like it just cannot get the path correct? I have tried a lot, ../assets, ../src/assets/ /dist/collection/assets etc, still the font is not being applied to my text.
Expected behavior:
The CSS using font-family: CUSTOMFONT would load and the text would have the custom font given.
The text was updated successfully, but these errors were encountered: