Skip to main content
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

@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!

 
답변 3개
  1. 2021년 5월 30일 오전 10:58
    HI Chris,

    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

    <link href="/resource/namespace__resourceName" rel="stylesheet"/>

    <ltng:require script="/resource/namespace__resourceName....."/>

    If this information helps, please mark the answer as best. Thank you

0/9000