I’ve been working with some of our front-end developers recently and getting to understand more and more about the different options available when branding SharePoint 2007. Branding SharePoint is a huge topic and I’m starting to recognise that whilst it’s sometimes possible to see the ‘wrong way’ of doing things, it’s not always so easy to see the ‘right way’ of doing things…
When to choose a Theme over an Alternate CSS file is a case in point. I asked this question of some of my colleagues who, between the lot of us, have done countless web content management (WCM) and collaboration solutions which involved custom branding to some extent or another. I was purposefully not looking at custom master pages and more advanced WCM, more focussing on collaboration solutions such as intranets or extranets – that more closely follow the out of the box SharePoint look and feel. As such I was expecting to get a definitive answer about which to use – even if it came down to personal preference. I didn’t.
Without exception the response I got was “it depends”. However, after digging a little deeper, here are some of the factors that may influence the decision on which to choose:
- Is it for a WSS, or for a MOSS solution without the Publishing Infrastructure site collection feature enabled? If so, then the Alternate CSS option is unavailable, and so a Theme is the only choice here.
- Do the end users have a need to switch between different look and feel options? In this case a Theme is probably the best option as SharePoint provides a nice interface to choose between themes with a preview image.
- When a Theme is applied to a site a local copy is placed in the _themes folder of the site. Theoretically this then allows for different sites to begin with the same Theme but to be customised, through SharePoint Designer, on a site-by-site basis. I haven’t seen this used in a real-world scenario, however I have seen it cause some minor issues in a team with multiple developers working on concurrently a Theme (not recommended).
- Unlike a Theme an Alternate CSS file is not stored locally, and so there are potentially performance gains through caching – though I expect this negligible.
- Without the use of custom code, Themes have to be applied per site, and are not applied to newly created sites. This is not so much of an issue as the code to have Themes applied to new sites, or to propagate it through existing sites is relatively trivial – but it is something that should be considered particularly on smaller projects. The Alternate CSS property can be set to be inherited throughout the site.
- A Theme is unable to style the out of the box Date Picker control because of the way it has been implemented (it doesn’t call the SharePoint:Theme control), whereas the Alternate CSS can.
- For an optimal installation experience a Theme will require some code (likely in a feature receiver) to update the SPThemes.xml file across the farm, whereas an Alternate CSS file can be deployed to the style library or 12 hive with relative ease.
Given these options I think that my personal tendency would be to go with an Alternate CSS file, however I can’t ignore the user experience side of things, which is that it’s much easier to change / apply a theme than it is an Alternate CSS file. I guess it really is a question of taking it on a case-by-case basis. So, I agree… it depends!