2

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

2 Answers 2

5

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

JavaScript

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

CSS

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

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

CSS

<link rel="stylesheet" href="/sites/IFICTeamSite/SiteAssets/MasterPageCss/masterPageCustom.css" ms-design-css-conversion="no" />
1
  • 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) Jan 16, 2015 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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