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 usually store my JavaScript/jQuery files in the Site Assets library, but I see on forums that others are using the Style Library.

What are the respective benefits of each?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

Resources in Style Library will most likely send the correct caching headers.

There were issues in 2007, here is a good rundown.

http://www.sharepointnutsandbolts.com/2009/05/optimization-blob-caching-and-http-304s.html

share|improve this answer
    
Wouldn't the issues also exist in 2010, in 2007 there was no Site Assets library - and really the Style library and the Site Assets libraries are just that - libraries. –  James Love Apr 27 '11 at 9:37

Another option is to deploy this to your _LAYOUTS folder.

As djeeg point out, Style Library has issues (304's due to incorrect max-age). I am not sure this is fixed (it would surprise me!).

Another plus for storing in a virtual directory is that you can use them across web applications, since they reside in the SharePoint root folder. This ofcourse can also be a weakness if you need permissions or versioning, so as usually when we are talking SharePoint, the answer is "it depends" :-)

share|improve this answer
1  
My question is specifically about Site Assets vs. Style Library. In my case (hosted), the _layouts folder is not accessible. I thought djeeg was recommending the Style Library: "... will most likely send the CORRECT caching headers". –  Christophe Apr 27 '11 at 8:35
2  
Ok, I have added SharePoint-Online tag to your post to clarify this! I would not bet money that the max-age problem is solved in SP2010, but given there is no alternatives thats just the way it is :-) As for recommendations, an asset library is ment for videos, pictures and sound for contributors, where Style Library is ment for CSS, JS, XSLT and images used for the layout of the site (icons etc) that the contributors will not need access to (other than Limited Read access). Remember to create your own subfolders... –  Anders Rask Apr 27 '11 at 11:18
    
Also the Style Library uses check in/check out and approval whereas the asset library does not (if that's a pro/con in your situation). –  PirateEric Apr 27 '11 at 12:20

Style Library is the default for pub portal template sites (i.e. internet facing sites).

share|improve this answer
1  
-1 The OP is asking what the respective benefits are of each. –  Alex Angas May 31 '11 at 22:58
    
Well one benefit would be following Microsoft guidelines. Style Lib is the way to go. I don't think my answer warrants a negative point. –  SPS Guy May 4 '12 at 22:29
    
Please could you edit your answer to expand on why you recommend the Style Library and a link to the MS guidelines? Then with any luck you will stop getting downvotes and multiple flags. See answer for general guidelines. –  SPDoctor May 7 '12 at 17:43

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.