0

Am trying to apply CSS for a page using SLDS which is refered from static resource but am unable to make it work. Please helpstatic resource for SLDS

Am refering the above resource in .app page as below

<ltng:require styles="/resource/SLDS/assets/styles/salesforce-lightning-design-system.min.css"/>
<div class="slds">
    <div class="slds-page-header">
    <p class="slds-page-header__Title" title="Race Tracker">Race Tracker</p>
    </div>
    <div class="slds-m-around--small slds-p-top--large">
    <c.newRace />
    </div>
    <div class="slds-m-around--small slds-p-top--large">
     <c.RaceList />
    </div>
</div>

1
  • Can you please let me know where are you using the component? In a visualforce page or in a lightning app under the context one/one.app in the url? Jul 27, 2017 at 13:17

2 Answers 2

1

I would recommend against using SLDS as a static resource in your case as this is no longer the best practice.

Since Winter '17, you can just extends force:slds (documentation here) in you app such as this:

<aura:application extends="force:slds">

Doing so will automatically add the right SLDS resources and you will not have to worry about SLDS upgrades.

0

You have to mention the static resource name followed by file Path of CSS inside SLDS Zip file.

<ltng:require styles="{!$Resource.SLDS + '/assets/styles/salesforce-lightning-design-system.min.css'}" />

Reference

6
  • i tried this <ltng:require styles="/resource/SLDS/assets/styles/salesforce-lightning-design-system-ltng.min.css"/> but this is not working Jul 27, 2017 at 11:12
  • Please try this <ltng:require styles="{!$Resource.SLDS + '/assets/styles/salesforce-lightning-design-system.min.css'}" />
    – NITHESH K
    Jul 27, 2017 at 11:23
  • /resource/SLDS/ no need to mention
    – NITHESH K
    Jul 27, 2017 at 11:23
  • Still not working i have used <ltng:require styles="{!$Resource.SLDS + '/assets/styles/salesforce-lightning-design-system-ltng.min.css'}" /> Jul 27, 2017 at 11:30
  • It should be working, i have verified its working Fine .
    – NITHESH K
    Jul 27, 2017 at 11:44

You must log in to answer this question.

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