0

My site is performing very slow. Google Page Speed suggests to use a few optimization algorithms, one of them is GZip. I have created some theme assets using this algorithm and imported my theme. Now I want to refer those files from my layout file. Existing code for getting these assets is as below

AssetLinks assetLinks = AssetLinksGenerator.GenerateLinks(new ThemesProvider());

but this provides me only js and css file. GZip algorithm created .gz files. Is there anyway to get other files like .gz from the theme, or do I need to customize something? Is there any place where I can feed these files to be picked up by AssetLinksGenerator?

5
  • That's not quite how GZip works on a web server. Have you enabled dynamic compression either in IIS or your web.config? Some info for you: stackoverflow.com/questions/17654301/… - bala.one/spice-up-sitecore-performance-with-iis - bartlomiejmucha.com/en/blog/…
    – Richard Seal
    Dec 30, 2021 at 15:05
  • @RichardSeal thanks for these links. Yes, we have dynamic compression enabled in prod.
    – Imad
    Dec 30, 2021 at 15:09
  • So you don't need to gzip the theme files and serve them via Sitecore. The server does the compression and the browser decompresses.
    – Richard Seal
    Dec 30, 2021 at 15:33
  • @RichardSeal there is a css file, it's size on disk is ~380KB, when served from local IIS (without dynamic compression) it is ~390KB, when served from Prod IIS(with dynamic compression) it is ~170KB. When I used npm build with webpack and Gzip plugin I got .gz file with size of ~65KB. I thought if npm is compression file so well then may be I can upload it and get this level of compression. What I am unable to understand is, if IIS using gzip when dynamic compression is set, why it is serving larger size than one created by npm
    – Imad
    Dec 30, 2021 at 16:54
  • Because IIS GZip is not the same thing as zipping the file locally.
    – Richard Seal
    Dec 30, 2021 at 18:40

0

Your Answer

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