2

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

4

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" />
  • 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.