How to add references to css and js files in HTML master pages. The files are residing in SharePoint libraries.


After trying out different options available online, I was able to achieve it by


<!--SPM:<SharePoint:ScriptLink ID="ConfigurationScriptLink" Name="~sitecollection/SiteAssets/js/FileName.js" runat="server"/>-->


<!--SPM:<SharePoint:CssRegistration ID="CSSCustom" Name="&lt;% $SPUrl:~sitecollection/SiteAssets/css/FileName.css %&gt;" runat="server" After="Themable/corev15.css"/>-->
| improve this answer | |

I have added it following way. May be very odd!


<link rel="stylesheet" href="/sites/IFICTeamSite/SiteAssets/MasterPageCss/masterPageCustom.css" ms-design-css-conversion="no" />
| improve this answer | |
  • Using CssRegistration has lot of advantages, for example After will make sure the styles get applied after SharePoint styles (this ensures our custom styles take precedence) – Amal Hashim Jan 16 '15 at 15:07

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.