3

i would like to prevent corev4.css from loading for a public site (100% anonymous) to reduce pages size. any suggestions please ?

2
  • Why do you want to prevent corev4.css when that's the CORE css? What are you trying to accomplish by reducing page size?
    – Mike
    Jan 14, 2013 at 19:57
  • 2
    @Mike corev4.css is used for backoffice in my case i use a personalized css, soo i dont need the CORE css
    – Mahmoud
    Jan 15, 2013 at 10:45

4 Answers 4

2

There is no way to accomplish this in a way that suits your goal. SharePoint will always add its CSS to each page. You could remove it client-side, but that doesn't solve your issue of reducing page size.

For public-facing sites, I have used Aptimizer (now owned by Riverbed): http://www.riverbed.com/us/products/stingray/stingray_aptimizer.php

Tools like Aptimizer compress, consolidate, etc., everything at the IIS level. Might be worth a shot.

2

I don't think it's 'impossible', because there is the

<SharePoint:CssLink runat="server" Version="4"/> 

control in the master page which you can conditionally replace with other kinds of references to stylesheets you need on your publishing site.

2
2

You need to make a custom control which inherits CssLink, and in that you need to make some logic which prevents the COREV4.css to be loaded based on some condition.

public partial class CustomCssLink : CssLink
{
    protected override void OnPreRender(EventArgs e)
    {
        // Logic here
    }
}
0

Why can't you create a custom master page and remove the < SharePoint:CssLink runat="server" Version="4"/> from the markup?

SharePoint will then not add the css file to the request and you will get a much "lighter" page. But then every out of the box control's css will have to be re-entered from your branding project in any case you are using the out of the box controls.

If you are making a public facing site the I assume that you have a custom master page and custom page layouts anyways and you are not in need of all the css that's inside of SharePoint?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.