Automagically updating themes

Themes are great in that you apply them and an entire WSS site is transformed before your very eyes. However there are some drawbacks to themes, namely they live on the SharePoint server (which you may or may not have access to in a production environment) and if you change a theme, it doesn't re-apply itself to a site immediately. Actually I've always found that you have to apply a different them, then re-apply your own theme. There are other ways to apply a theme like using the Object Model but that requires code, etc. and is pretty messy just to change the look of your site.

Here's a trick that you may want to employ for your sites. Create a new theme using the normal editing process as outlined in the SDK. However when it comes to editing your THEMES.CSS file, simply enter this for it:

@import url("http://servername/filename.css")

The filename above refers to a CSS file that you control. Place it on a central web server or something and update it anytime you want. Voila. All WSS sites using this theme will be instantly updated (well updated the next time a user visits the page) using the changes you apply to your CSS file.

A couple of additional tricks you can do here. Rather than put your CSS file on a web server (where it might not be accessible due to production servers being locked down) put it into a SharePoint document library. Not only will you get security around it but you get version control for free. Another thing is you can combine the THEMES.CSS file with the stock SPS.CSS file to create a mega-CSS file that both your portal AND your WSS sites can use and create a consistent look between the two.


No Comments