You need to sign in to do that
Don't have an account?
Chris Villanueva
Using custom fonts in managed package with LWC
Hello,
I have added a static resource for custom fonts in .woff format. I am using the static resource in my lightning web compnent in the css file with the following
component.css
This works perfectly fine when I am working in my development organization. But the issue is when I create a managed beta package and include the component and static resource.
Once I upload the package and install it in a separate test org, the component is no longer able to find the custom font / static resource. I receive the following error in the browser developer console on Google Chrome
Can I get some guidance on what I am missing here when it comes to using a static resource custom font in an installed managed package? Thank you!
I have added a static resource for custom fonts in .woff format. I am using the static resource in my lightning web compnent in the css file with the following
component.css
@font-face { font-family: 'CustomFont'; src: url('/resource/CustomFont') format('woff'); }
This works perfectly fine when I am working in my development organization. But the issue is when I create a managed beta package and include the component and static resource.
Once I upload the package and install it in a separate test org, the component is no longer able to find the custom font / static resource. I receive the following error in the browser developer console on Google Chrome
GET https://companytestorg.lightning.force.com/resource/CustomFont net::ERR_ABORTED 404 (Not Found)
Can I get some guidance on what I am missing here when it comes to using a static resource custom font in an installed managed package? Thank you!
Based on similar posts from past, it appears to be an issue with the referenced URL
Related: https://salesforce.stackexchange.com/questions/204695/custom-fonts-not-working
https://salesforce.stackexchange.com/questions/56897/font-files-in-static-resources-resolve-to-404
https://salesforce.stackexchange.com/questions/38940/is-it-possible-to-access-static-resource-of-a-managed-package-in-a-local-vf-page
Try using the managed package namespace prefix.Something like If this information helps, please mark the answer as best. Thank you
All Answers
Based on similar posts from past, it appears to be an issue with the referenced URL
Related: https://salesforce.stackexchange.com/questions/204695/custom-fonts-not-working
https://salesforce.stackexchange.com/questions/56897/font-files-in-static-resources-resolve-to-404
https://salesforce.stackexchange.com/questions/38940/is-it-possible-to-access-static-resource-of-a-managed-package-in-a-local-vf-page
Try using the managed package namespace prefix.Something like If this information helps, please mark the answer as best. Thank you