1

When trying to access stylesheet in lightning component it's showing error message

<ltng:require styles="{!$Resource.SLDS90,'assets/styles/salesforce-lightning-design-system-vf.css'}"/>

Failed to save AccountComp.cmp: unexpected token: ',' at column 18 of expression: $Resource.SLDS90,'assets/styles/salesforce-lightning-design-system-vf.css'): Source

8
  • I think you're missing the beginning of your formula. Shouldn't it start with {!URLFOR( ?
    – Kasper
    May 18 '18 at 11:32
  • if i add urlfor its again give errorr...... No function found for key: URLFOR: Source May 18 '18 at 11:33
  • 3
    On a side note, You dont need to import SLDS CSS if you are using it components in lightning mode. May 18 '18 at 11:33
  • 1
    My bad, I was thinking about visualforce. I think you have an unnecessary ) at the end though.
    – Kasper
    May 18 '18 at 11:36
  • Kasper its showing error after remove ")" by mistaken i added May 18 '18 at 11:44
1

I think this should work. I think you, like me, may still be used to the visualforce way of doing this :). The differences can be subtle at times.

<ltng:require styles="{!$Resource.SLDS90 + 'assets/styles/salesforce-lightning-design-system-vf.css'}"/>
1
  • I got the mistake that in my app use extends="force:slds" now its worked... no need to use of ltng:require May 18 '18 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.