1

In my master page, I have reference to theme file as-

<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server" />

My problem is on my site for different locales, the CSS file is getting localized

Like, for en-us site theme CSS reference is from (on initial load) -

<site collection url>/_catalogs/theme/Themed/28DE9520/corev15-65D9856.themedcss

But for some other locale pt-br, the reference for theme file is like -

<site collection url>/_layouts/15/1046/styles/Themable/corev15.css

Can I have a solution for this where CSS file is always referenced from -

<site collection url>/_catalogs/theme/Themed/28DE9520/corev15-65D9856.themedcss
  • try adding Localizable="false". I mean <SharePoint:CssRegistration Name="Themable/corev15.css" runat="server" Localizable="false"/> – Atish Dipongkor - MVP Nov 17 '16 at 12:32
  • Localizable is not a property of CssRegistration class – Saurabh Verma Nov 17 '16 at 12:39
  • yeah true. totally overlooked at the question – Atish Dipongkor - MVP Nov 17 '16 at 12:54
  • Try taking the CSS out of the hive and placing it in the Style Library => en-us => Themable folder at the top level of your site collection. This is considered best practices for SharePoint 2013 anyways. – lazoDev Nov 17 '16 at 14:04
0

Try taking the CSS out of the hive and placing it in the Style Library => en-us => Themable folder at the top level of your site collection. This is considered best practices for SharePoint 2013 anyways. Also, make sure your css runs after the cores.

<SharePoint:CssRegistration ID="CssRegistration" Name="/Style Library/en-us/Themable/customized.css" runat="server" After="corev15.css" />
  • Using this will hard code the path, but I want specifically the file to be referred automatically from - <site collection url>/_catalogs/theme/Themed/28DE9520/corev15-65D9856.themedcss irrespective of Locale – Saurabh Verma Nov 18 '16 at 5:39
0

The CSS reference is generic for whatever theme you have active in the site.

<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server" />

The folder id is generated when you apply a theme to a specific site:

e.g. /_catalogs/theme/Themed/28DE9520/corev15-65D9856.themedcss

different sites will have different theme folders so you should definitely not use hardcoded paths to the theme file.

Therefore, I suggest you look into an altenative approach:

0

Using attribute EnableCssTheming="true" in SharePoint:CssRegistration tag restricts the file to take it from <site collection url>/_catalogs/theme/Themed/28DE9520/corev15-65D9856.themedcss path irrespective of user locale

Hence, the solution which worked for me is -

<SharePoint:CssRegistration Name="Themable/corev15.css" EnableCssTheming="true" runat="server" />

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.