Tuesday, June 9, 2009

Theme not updating on refresh

If any of you have been working with themes in your visual studio projects you probably didn't get them right frst time. Heck, you probably didn't get them right after the 50th update. If you're creating the theme in a wsp and keep on deploying it and are only working on one single site with no sub sites, then you won't have the update issue. But my guess is that you do.

As soon as you apply a theme to a site it copies the theme.css into the site under the _themes folder. This means the page is automatically unghosted and any changes simply won't show up unless you remove the theme and reapply the theme. The solution to the dilemma is to put all the real css stuff into a separate css file somewhere in the hive (preferrably under layouts/styles or layouts/1033/styles) and only reference it from the theme.css using the import statement.

Sure it is a bit hacky, and yes, you would also put all the images into a folder outside of the actual theme folder but hey! a) it works, b) you can see your changes reflected instantly across all sites using the theme and c) it still can be packaged into a feature and wsp package meaning you'll be fine even after the next update.

Heather Solomon, the master of sharepoint css has a great article on how to do the referencing with themes on her blog:


No comments: