I know how to deploy the masterpages and styles like css, javascripts, images etc, my question is rather what is the best practice?

As I deploy the all the requisites on a site collection in the style libraries etc by the site collection scoped feature. Activating this feature will activate the styles on this site collection. So for each site collection in style libraries those files will be created.

But in masterpage I can also refer all my css registrations and images etc for a root site collection, this way only activating the feature on the root site collection will aslo affect the other site collections if the master page is applied, and I only will have those files on the root site collection style library.

I'm hesitating between this, of course only activating on the root site collection, will reduce the amount of files in the portal but still ... Of course by doing this I will have everywhere the same layout and styles for all the site collection but that is also the case what I want to achieve.

So should I deploy only on root site collection, or for every site collection differently?

2 Answers 2


Since you have packaged your branding elements including master page, css, images, js, etc into a feature (scoped to site), then I recommend that you activate this feature on each site collection (root site and sub site collections, i.e. yourdomain/sites/subsite1). The feature should include a module to transfer _catalogs/masterpage assets and at least another module to transfer Style Library assets. Since you are using a feature anyhow, any time you make an update the the branding, the feature should handle updating the assets and you can use powershell to force the upgrade to all site collection.

Yes, this means that each site collection will include all branding elements, but each site collection needs to at least include the masterpage assets anyhow. For the Style Library you could always place those elements in the 14 hive (_layouts). In your case that would be the best location for them.

If you wanted to have only one copy of Style Library assets, just at the root site collection, then you would most likely need to have two features, one that installs the master page and another that installs the style library assets. Activate the master page feature on all site collections, but the style library one only on the root site collection. Then set the master page to always reference only the root site collection style library. But if you are doing this, then why are you using a feature, you are making it more difficult for yourself.

I hope this helps.

  • yeah i understand, basically it is just my choice there is no really this is better or that is how everyone does ... in sharepoint i always have dilemma's with approaches each of them is possible but what would be better ... no one knows
    – Shkipper
    Aug 21, 2012 at 5:57
  • Deploying in _layouts is certainly an option, but this would also make your branding artifacts available to the whole farm, more difficult to Scope to only the desired Site Collection or Web Application. You should keep that option for really global artifacts (e.g. logo, javascript libs -debatable too, feature images, ). Besides if you have multiple branding artifacts you folder structure would go haywire quickly when having hundreds of varied site collections. Aug 21, 2012 at 8:59

I believe the issue here requires clearing the issue of "root site collection vs other site collections" as each Site Collection in its own is an Isolation boundary, be it root or not. Basically the practice of deploying at Site Collection level (e.g. using Style Libraries) is a recomanded practice, and also it does follow the same isolation unit as the Site Collection itself.

If you ever consider Sandboxed solutions than this model would also fit. The only major downside is really updating across all site collections when you need to change master page, page layouts which are already in use.

  • 1
    the difference between root site collection and other site collections is that root site collection is the first site collection, and other site collection reside so to speak in root site collection
    – Shkipper
    Aug 20, 2012 at 13:30
  • so with other words even if the site collection use the same master page and styles it is better for each to have their own files on their level and not on some parent where all site collections could retrieve from?
    – Shkipper
    Aug 20, 2012 at 13:31
  • You got it right! Aug 20, 2012 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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