Built-in CSS versioning
I have not seen any documentation on this, so I thought I should post information about the built-in CSS version query string in Sitefinity.
By default, when you add a css file to your theme, Sitefinity will add a query string with the version number such as style.css?v=60743210. This is very helpful for making sure that when you push updates your users immediately get your updated styles.
There is one important thing to know in order to get this to work. As far as I can tell, your theme must be in the ~/App_Data/Sitefinity/WebsiteTemplates/[YourFolder]/App_Themes/[YourTheme]/ folder, otherwise the query string will not be added. It does not work if your theme is in ~/App_Themes/[YourTheme]/
Hi Michael,
Thank you for sharing this information with the community.
Regards,
Sabrie Nedzhip
Telerik
Do we know what causes the version number to change? What triggers a new version number?
Also, I've noticed that CSS files in the ~/App_Data/Sitefinity/WebsiteTemplates/[YourFolder]/App_Themes/[YourTheme]/Global folder do get the version number, but if you have files in deeper folders like ~/App_Data/Sitefinity/WebsiteTemplates/[YourFolder]/App_Themes/[YourTheme]/Frameworks/Telerik it doesn't get a version number.
So the question is really, what are the exact rules around this versioning feature?
Hey Jacques,
As also posted on SO (but just for completion here) the behavior is part of the ThemeController class inside Telerik.Sitefinity.dll and essentially checks for the file last write time-stamp to include the cache busting version number.
string str = string.Concat(VirtualPathUtility.AppendTrailingSlash(theme.Path), "global/", fileInfo.Name);