0

I have a CSS with a class like this:

  .c-rating__item {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 24px;
        -ms-flex: 0 0 24px;
            flex: 0 0 24px;
    height: 24px;
    background: url("/resource/fivestar/stars.svg");
    background-position: 0 0;
    cursor: pointer;
  }

And it's working fine. The problem is when I generate the package and install it in a different Org, I get a 404 error:

Request URL: https://xxxxxxxxxxxxxx/resource/fivestar/stars.svg

Request Method: GET

Status Code: 404 Not Found

Any idea how I can solve this?

5
  • Verify that the stars.svg file is included in the static resources of your package. - ideas.salesforce.com/s/idea/a0B8W00000N58EtUAJ/… Commented Jul 18 at 7:18
  • 1
    This question is similar to: LWC: How to use static Resource Image in CSS in Lightning Web Component?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Jul 18 at 7:24
  • Obviously, I have verified the svg is included. If you read my comment, It works fine in my scratch org. It breaks when you generate a managed package with a namespace. It not the same question than you suggested. My problem is when I generate a managed package with a namespace. Commented Jul 18 at 7:42
  • I cannot use the post that you refer because the rules are clear: But avoid … Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. Commented Jul 18 at 7:44

1 Answer 1

0

Solved: I just need to add the namespace in the static resource reference:

background: url("/resource/MyNamespace__fivestar/stars.svg");

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .