Sharepoint - Images and Css located in the _layouts folder

I often store images, css, js, etc somewhere in a sub folder under _layouts and deploy these files using WSP deployment. I haven't really experienced any issues with this approach.

I'd say it's safe.


Ways to determine if you want to store images in _LAYOUTS and in shared image libraries like Style Library:

  • If you want your end users to edit/create new versions of your data you should choose Style Libraries (or Image Libraries) and if you dont want end users to mess around with layout images etc choose _LAYOUTS (in a subfolder!)
  • Performance wise, images/css/js stored in image libraries can be cached using External Storage Locations (BLOB storage). (In my experience, still after SP2 ESL is still quite buggy and you will need to flush the disk based cache regularily to avoid JS errors)
  • Host header on image libraries does not set max-age property correcly. This triggers alot of 304 traffic from the client to the server. You dont have this problem in _layout folder (read, http://www.kindohm.com/archive/2008/06/20/eliminating-quot304quot-status-codes-with-sharepoint-web-folder-resources.aspx )
  • If you want your binaries to vary based on regional settings, choose the appropriate subfolder in layouts (eg 1033)

Theres probably more, but thats just off the top of my head what i use myself to determine where i store my binaries

Tags:

Deployment