Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to be able to auto-version these in SharePoint and I'm looking for the best solution.

SharePoint does it with some of it's files. For example:

<link rel="stylesheet" type="text/css" href="/_layouts/1033/styles/Themable/search.css?rev=Uoc0fsLIo87aYwT%2FGX5UPw%3D%3D"/> 

Notice this ?rev=Uoc0fsLIo87aYwT%2FGX5UPw%3D%3D at the end of the URL.

I want to do the same with my custom css and js, but can't find the right control to make this happen besides manually modifying the extension.

Basically to force browser cache to invalidate when a new CSS or js is changed. No more CTRL-F5 for a user to ensure they have the latest.

Another SO question on what this is: http://stackoverflow.com/questions/438821/what-does-do-in-a-css-link/438828#438828

I've looked at controls such as CSSRegistration.Register(), but there doesn't appear to be an option.

share|improve this question
    
Will this be on an aspx page? –  Abe Miessler Jun 16 '11 at 18:45
    
Yes, a master page or aspx page. –  Shane Jun 16 '11 at 19:41
    
What is outputting the links to those files, is it a web part or a custom master page or something else? –  Ryan Jun 17 '11 at 6:30
add comment

2 Answers 2

You should be able to version your custom assets using the Publishing Features of SharePoint Server

share|improve this answer
    
I don't mean just keeping a version for the usual versioning in a document library, but including it in a master page for example, such as: <link rel="stylesheet" type="text/css" href="/Style Library/Custom.css?rev=Uoc0fsLIo87aYwT%2FGX5UPw%3D%3D"/> so that that rev tag ensures a user is always downloading the current CSS. –  Shane Jun 16 '11 at 17:11
    
Hm. I would think that any time you reference a document inside of a document library that includes versioning, it will always return the most recent version. That seems like it would be default behavior. –  Tim Gabrhel Jun 16 '11 at 17:16
    
If it's cached on the client machine that's not always true. –  Abe Miessler Jun 16 '11 at 18:43
add comment

Can you do something like this if you can edit the ASPX page:

<script type="text/javascript" href="/project/JS/myJSFile.js?rev=<%= DateTime.Now.Ticks.ToString() %>"></script> 
share|improve this answer
    
that would make it different every single time, therefore the javascript file would never cache. We want it to cache unless we rebuild and solution and push it out again. –  Shane Jun 16 '11 at 19:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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