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) Commented Jan 16, 2015 at 15:07

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.