Many organizations are using the SharePoint to design the organization’s internal portal. As I observed many newbie have the doubt whether they want to copy JavaScript, images and CSS files to SharePoint document library or 12hive’s _layout folder. I would like to discuss advantage and disadvantages of these approaches.  Here are some advantages using document library to serve the contents-

  1. Maintenance,
  2. Versioning,
  3. History, tracking.

Some disadvantages are using SharePoint document library to store the JavaScript, css and images used in portal.

  1. Client side cache:  Browser cache is not enabled for SharePoint library because it is SharePoint library is dynamic. You can use the http watch tool to analyze the http request.
  2. Server side performance:  Due to client side cache does not exist, browse request the server for each user request instead of using browser’s cache, It will increase the network round trip, so it will impact on server performance as well. (We could overcome this issue with blob cache, you can find my other article blob cache on this).

You will get some added advantage storing the restores on 12hive’s _layout folder. If you want to store the JavaScript, css, Images on 12hive layout folder, then you need to consider below points, Storing the JavaScript, images and css files on layout folder definitely boost the application performance.

  1. Versioning: needs to use free tools like SVN for change history and tracking.
  2. Maintenance: It would be nice if you have the SharePoint feature, feature consists of custom master page (for minimal master page check here), JavaScript, images and css files used in master page. Deploying the feature will copy the master page to master page gallery and related resource to layout folder. You can check my other article on deploying minimal master page feature.

I preferably like to have the files on _layout folder, Again it is depends on the project requirement, It is better to have the frequently changing files on SharePoint library for maintenance prospective.

Check this article on Dynamic HTTP Compression to enhance the performance of SharePoint portal.
You can find some good article for fine tuning the performance and cache sharepoint best practices

Similar Topics: