I have created a folder name myResources. It has two sub folders styles and scripts. scripts folder has two files js1.js and js2.js. styles folder has one file styles.css.


And I am trying to load it as below

<ltng:require styles="/resource/myResources/styles/styles.css" 
                  afterScriptsLoaded="{!c.setup}" />  

I have also tried

<ltng:require styles="{!$Resource.myResources+ '/styles/styles.css'}" />
<ltng:require scripts="{!join(',', 
                           $Resource.myResources+ '/scripts/js1.js', 
                           $Resource.myResources+ '/scripts/js2.js')}" 
                  afterScriptsLoaded="{!c.setup}" />  

But not luck so far, I don't know what I am doing wrong.
My static resource name is myResources.
Note: I have upload them individual files not .zip file It loads successfully.
Following this tutorial Loading External JavaScript And CSS Libraries To Lightning Components

  • Are you sure you named your static resource "resource" ? Feb 2, 2017 at 10:59
  • yes I am sure it is myResources I can see in setup->static resource . It has name is myResources and type application/octet-stream
    – ozil
    Feb 2, 2017 at 11:02

1 Answer 1


Since your folder name and static resource name both are myResources, its leading upto a confusion.

You need to include your folder name as well in the path like this.

<ltng:require styles="/resource/myResources/myResources/styles/styles.css" 
                  afterScriptsLoaded="{!c.setup}" />

You must log in to answer this question.

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