i would like to prevent corev4.css from loading for a public site (100% anonymous) to reduce pages size. any suggestions please ?
-
Why do you want to prevent corev4.css when that's the CORE css? What are you trying to accomplish by reducing page size?– MikeJan 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– MahmoudJan 15, 2013 at 10:45
4 Answers
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.
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.
-
-
Please read these: nothingbutbranding.com/blog/2012/october/… cleverworkarounds.com/2007/10/08/… panvega.wordpress.com/2009/04/01/… Feb 1, 2013 at 13:42
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
}
}
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?