1

This is a follow up to my question here.

A custom CSS file is referenced in my customer master page, like this:

<SharePoint:CssRegistration Name="/_catalogs/masterpage/custom.css" runat="server"></SharePoint:CssRegistration>

Problem: when I make changes to the CSS file (using SharePoint Designer) the changes are not reflected.

If I comment out the reference to the CSS file in the master page, this is reflected fine, so changes to the master page is not the problem.

For info, publishing is not enabled on the site collection.

Could this be something to do with the CSS file residing in the master page gallery?

6
  • Is the CSS file loaded on the page?
    – Akhoy
    Commented Oct 7, 2015 at 10:50
  • Yes it loads fine, and when I remove the reference in the master page it doesn't load, as expected.
    – Submits
    Commented Oct 7, 2015 at 10:51
  • Don't think it's because it's in the Master Page gallery. I just checked and it works fine. Is your master page in the same folder as /_catalogs? When I checked using <link type="text/css" rel="stylesheet" href="CSSFile.css">, I get only the name of the file in the href part and not /_catalogs.
    – Akhoy
    Commented Oct 7, 2015 at 11:02
  • The master page is in /_catalogs/masterpage, as is the CSS file. The reference to the CSS file is definitely working fine because I can see in Chrome's developer tools it is being loaded. And as I mentioned, when I remove the reference to the CSS file in the master page, Chrome's developer tools shows it has not loaded and I can physically see that the page looks different without the CSS file referenced. So the reference to the CSS file is working fine. It's changes to the CSS file itself that's not working.
    – Submits
    Commented Oct 7, 2015 at 11:05
  • Akhoy, you were absolutely right about /_catalogs. I mistakenly thought /_catalogs/masterpage would refer to the current site collection's master page gallery, but actually it refers to the very top level site collection's master page gallery. What this means is my predecessor set up the branding so all sites use a COPY of the custom master page, but all those master pages reference a single CSS file. I wonder why it was done like this... Anyway, happy to accept as the answer if you rewrite as an answer. Thanks
    – Submits
    Commented Oct 7, 2015 at 13:04

1 Answer 1

1

Posting comment as answer

I don't think it's because it's in the Master Page gallery. I just checked and it works fine.

Is your master page in the same folder as /_catalogs? On checking using <link type="text/css" rel="stylesheet" href="CSSFile.css">, I get only the name of the file in the href part and not /_catalogs.

Make sure CSS reference is correct.

1
  • 1
    Thanks. And for the benefit of others with a similar issue, I managed to reference the CSS file in the master page gallery of the CURRENT site collection like this: <SharePoint:CssRegistration Name="<% $SPUrl:~SiteCollection/_catalogs/masterpage/custom.css %>" runat="server"></SharePoint:CssRegistration>
    – Submits
    Commented Oct 7, 2015 at 13:40

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.