3

I've loaded css/js static resources to Salesforce in a fivestar.zip file. This resource also contains an svg.

fivestar.zip
--rating.css
--rating.js
--stars.svg

When attempting to load these resources via

<ltng:require styles="{!$Resource.fivestar + '/rating.css'}" 
              scripts="{!$Resource.fivestar + '/rating.js'}"
              afterScriptsLoaded="{!c.afterScriptsLoaded}" />

I'm getting the following 404 errors via Chrome console :

GET https://curious-badger-85919-dev-ed.lightning.force.com/resource/1534019843000/fivestar/rating.js 404 (Not Found)

and

GET https://curious-badger-85919-dev-ed.lightning.force.com/resource/1534019843000/fivestar/rating.css 404 (Not Found)

I'm assuming this has to do with my ltng:require tag being incorrect, which is why I haven't included other code.

1 Answer 1

6

Your tag seems correct, its your file path that seems to be off, mind sharing your zip file tree structure?

Did you zip the files directly, or you zipped a filder that contains these 3 files? if the later is your case, then your reference should be something similar to the below:

<ltng:require 
    styles="{!$Resource.fivestart+ 'toplevelfolder/rating.css'}"
    scripts="{!$Resource.fivestart+ 'toplevelfolder/fivestar.js'}"
    afterScriptsLoaded="{!c.scriptsLoaded}" />
3
  • @gils I zipped a folder containing these files. That worked - thank you. Aug 11, 2018 at 21:37
  • I've also found that quitting and reopening chrome sometimes solves this issue, especially when hosting components in communities. Seems like there's caching going on that causes sporadic issues loading static resources. Aug 18, 2018 at 6:26
  • 1
    might be that you have persistent browser caching enabled in your org - you can disable it under session settings
    – glls
    Aug 18, 2018 at 13:39

You must log in to answer this question.

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