We are using Sitecore 8.2 and we have around 10-15 Page templates and all the CSS is bundled in a Global CSS and over the years the CSS file has grown tremendously resulting in below issues:

  1. We are loading lot of unused CSS which not be required for all pages for example Product & Article page CSS may not be required for Home Page & Vice versa.
  2. This has resulted in lot of performance issues.

Is there a module or Utility which can load only Required CSS for a page considering the fact we have single Layout for the pages.

  • 1) what is the problem with it? in general it should not be a problem to load unused CSS 2) how big is your CSS? do you have client side caching enabled for static files (CSS, JS)? Aug 14 '19 at 8:49
  • its actually around 10 MB and it's cached & Bundled we actually want to load only used CSS on a page Aug 14 '19 at 10:45
  • 10 MB of bundled CSS is very huge, what will be the size of a beautified CSS in this case? with regards to your question, I think you should have separate files for each page template type and add current item template condition to render the CSS specific to that page type. Aug 14 '19 at 11:12
  • 6
    If you have 10MB of CSS, then you are trying to solve the wrong problem. Optimize your CSS file, and I don't just mean minify it, there are underlying architectural problems with a CSS file that big and they should be addressed. Especially if you only have 10-15 page templates.
    – Richard Seal
    Aug 14 '19 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.