0
votes

I found the following link describing Sitefinity's built-in CSS file versioning feature, but it lacks detail and unfortunately I can't find anything in Sitefinity's documentation. http://www.sitefinity.com/developer-network/forums/designing-styling/built-in-css-versioning

It seems that files in the following folder will automatically get a version number:
~/App_Data/Sitefinity/WebsiteTemplates/[YourFolder]/App_Themes/[YourTheme]/Global

But, if you have them in a subfolder such as:
~/App_Data/Sitefinity/WebsiteTemplates/[YourFolder]/App_Themes/[YourTheme]/Frameworks/Telerik
Then versioning doesn't get applied.

What I'm trying to understand is what the actual triggers are for incrementing the version number?
When we deploy code we'd like to know that the user is going to get a fresh copy of all CSS files.

2

2 Answers

1
votes

You can use things like ASP.NET Bundling and Minification and it takes care to update the bundle when you make a change in any of the source files. It is available as a Nuget package (Microsoft.AspNet.Web.Optimization) and is quite good.

0
votes

Sitefinity uses the following snippet to trigger a new version:

Version = fileInfo.LastWriteTime.Ticks.ToString();

They retrieve the info for all files, however where the theme folder is configurable, the /global part seems to be hard-coded using the following:

string str = string.Concat(VirtualPathUtility.AppendTrailingSlash(theme.Path), "global/", fileInfo.Name);

(For details check out the class ThemeController in Telerik.Sitefinity.dll).

So you could go with Veselin's approach and use Web Optimization or you can extend the current stylesheet widget to add a versioning string to the output, with a similar technique as above.