3

I'm currently using cssregistration to add css to sharepoint pages. All is working until I need to do an upgrade of the css. The context is:

I used a delegate control in a feature containing the cssregistration component so that I can activate the feature wherever I want. The problem is when I update my CSS file (located in the LAYOUTS folder) and do an upgrade of the WSP solution, the users don't see the changes. SharePoint is keeping the old version of the CSS (using the old rev number). In fact I need to deactivate/activate the feature to be able to see the changes.
Is it normal? What is exactly the working process of CSSRegistration component?

Thanks for your help.

  • Do you remember to clear your browser cache everytime? ctrl + F5 (ctrl + alt + E for safari) – user2536 Dec 21 '11 at 12:10
  • Yes I did everything for clearing browser cache :( – Win Dec 21 '11 at 12:54
3

Chris O'Brien wrote a cool post recently about all problems with cached css and javascript files in sharepoint.

UPDATE
If you are using themable css and EnableCssTheming set to true and your site use some theme (using theme is required), sharepoint will compile your css file into another css file with replacing placeholders, that looks like /* [ReplaceColor(themeColor:"Accent6")] */ This css files have ?ctag= querystring parameter (not "?rev="). To make themable css updated, you need to reapply your theme on every update.
More info about themable css you can read here part1 and here part2

If you are not using themable feature (like dynamically replaceable css parameters), you may set EnableCssTheming to false, and you css file will be act as usual.

About updating ghostable in library .thmx file. I am not 100% sure, but I think sharepoint don't touch this file on every http request (but only once when you are applying the theme), this means that you should reapply theme on every update.

  • I already read this post, but the thing is in my case the ctrl + F5 or ctrl + R is not working. I think this is more a problem on server side (not client side) in my case. – Win Dec 21 '11 at 13:18
  • Have you tried Cris's approach? Using described technique you no longer need to do manual refresh – Sergei Sergeev Dec 21 '11 at 13:27
  • If it can helps, I discovered that my problem is linked to the themable functionality of CSSRegistration component. Since I set the EnableCSSTheming property of the control to false and moved my css file outside the themable folder, my css files started to be refreshed normally after wsp upgrades. If anyone knows anything about this behavior... – Win Dec 21 '11 at 14:08
  • If you are using themable css and EnableCssTheming set to true and your site use some theme (using theme is required), sharepoint will compile your css file into another css file with replacing placeholders, that looks like '/* [ReplaceColor(themeColor:"Accent6")] */' This css files have ?ctag= querystring parameter (not "?rev="). To make themable css updated, you need to reapply your theme on every update. – Sergei Sergeev Dec 21 '11 at 14:11
  • More info about themable css you can read here part1 and here part2 – Sergei Sergeev Dec 21 '11 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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