locked
location to put multiple css and js files _layouts or stylelibrary RRS feed

  • Question

  • In sp 2013 which location to put multiple css and js files _layouts or stylelibrary is best approach in terms of performance.

    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Friday, June 13, 2014 2:58 PM

Answers

  • Hi.

    If you put your file in the layout folder, that files are available for all the web application on your farm: performance are better but you have to have access to your front end to release data.

    If you put your file in the style library, data are stored on the content database and then the process to retrieve this information in more expensive. To manage this files, you can have no access to the farm, but you can manage that using the browser.

    In other words, depends on your needs


    Regards,
    Bubu
    http://zsvipullo.blogspot.it

    Please mark my answer if it helped you, I would greatly appreciate it.

    • Proposed as answer by sk2014 Monday, June 16, 2014 9:56 AM
    • Marked as answer by Dennis Guo Sunday, June 22, 2014 1:32 PM
    Friday, June 13, 2014 3:04 PM
  • At a high level, it often depends on your view of the function of the files:

    site 'infrastructure' which is critical to branding (e.g. public-facing WCM). Here you might choose to store on the filesystem as users/content authors will never be modifying the files
    content specific to an individual site, open to customization (e.g. a team site in a collab portal). Here you might store in a library as power users most definitely will want access to these files.
    A note on performance - BLOB caching is generally required to get equivalent performance from document libraries and the filesystem - there's more to it than just SQL. Last year I did some optimization work for a public-facing airline site with poor performance, and I found that a big factor was CSS/JS files coming from the Style Library. The issue turned out to be a bug in SharePoint's BLOB cache framework which meant the files were being served with incorrect headers, meaning a HTTP 304 roundtrip occurred needlessly for every file before it was served from the browser cache. The details of this are in my posts:

    Optimization, BLOB caching and HTTP 304s
    More on optimization, HTTP 304s etc. – a solution?

    The conclusion to all this was that it is possible to get good performance from files stored in such document libraries, but there are a couple of hoops to jump through first. Maxime documented these in BlobCache, Style Library, and anonymous users

    • Edited by Aanchal22 Saturday, June 14, 2014 2:54 PM
    • Marked as answer by Dennis Guo Sunday, June 22, 2014 1:32 PM
    Saturday, June 14, 2014 2:52 PM

All replies

  • Hi.

    If you put your file in the layout folder, that files are available for all the web application on your farm: performance are better but you have to have access to your front end to release data.

    If you put your file in the style library, data are stored on the content database and then the process to retrieve this information in more expensive. To manage this files, you can have no access to the farm, but you can manage that using the browser.

    In other words, depends on your needs


    Regards,
    Bubu
    http://zsvipullo.blogspot.it

    Please mark my answer if it helped you, I would greatly appreciate it.

    • Proposed as answer by sk2014 Monday, June 16, 2014 9:56 AM
    • Marked as answer by Dennis Guo Sunday, June 22, 2014 1:32 PM
    Friday, June 13, 2014 3:04 PM
  • At a high level, it often depends on your view of the function of the files:

    site 'infrastructure' which is critical to branding (e.g. public-facing WCM). Here you might choose to store on the filesystem as users/content authors will never be modifying the files
    content specific to an individual site, open to customization (e.g. a team site in a collab portal). Here you might store in a library as power users most definitely will want access to these files.
    A note on performance - BLOB caching is generally required to get equivalent performance from document libraries and the filesystem - there's more to it than just SQL. Last year I did some optimization work for a public-facing airline site with poor performance, and I found that a big factor was CSS/JS files coming from the Style Library. The issue turned out to be a bug in SharePoint's BLOB cache framework which meant the files were being served with incorrect headers, meaning a HTTP 304 roundtrip occurred needlessly for every file before it was served from the browser cache. The details of this are in my posts:

    Optimization, BLOB caching and HTTP 304s
    More on optimization, HTTP 304s etc. – a solution?

    The conclusion to all this was that it is possible to get good performance from files stored in such document libraries, but there are a couple of hoops to jump through first. Maxime documented these in BlobCache, Style Library, and anonymous users

    • Edited by Aanchal22 Saturday, June 14, 2014 2:54 PM
    • Marked as answer by Dennis Guo Sunday, June 22, 2014 1:32 PM
    Saturday, June 14, 2014 2:52 PM