Monday, January 12, 2015

Adding CSS reference to a SharePoint master page in 2013

There are a couple of techniques for adding a reference to a css file to a master page, but ​in 2013 there is a new element to use.

CSSRegistration.

An example in a standard .master file looks like this:

<SharePoint:CssRegistration Name="<%$SPUrl:~Site/SiteAssets/MetroJs/MetroJs.css% >" runat="server">

If you are using the Design Manager feature and creating a master page in HTML, then you need to encode the < and >

<SharePoint:CssRegistration Name="&lt;%$SPUrl:~Site/SiteAssets/MetroJs/MetroJs.css%&gt;" runat="server">


No comments: