{"id":6624,"date":"2021-08-25T12:27:52","date_gmt":"2021-08-25T12:27:52","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=ht_kb&#038;p=6624"},"modified":"2024-10-16T09:20:07","modified_gmt":"2024-10-16T09:20:07","slug":"generate-unique-css-in-litespeed-cache-for-wordpress","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/generate-unique-css-in-litespeed-cache-for-wordpress\/","title":{"rendered":"How to Generate Unique CSS in LiteSpeed Cache for WordPress"},"content":{"rendered":"<p>You probably take a lot of pride in the appearance of your website. Maybe you&#8217;ve spent a lot of time (and\/or money) on customizing your website to give it a unique look. Unless you&#8217;ve been working with the code directly, you may not know this, but your website&#8217;s appearance is owed to a series of CSS files that are loaded each time a page is requested by a client&#8217;s browser. What you also may not know is that not every page needs to load every style in the library, and server resources are often wasted parsing code that isn&#8217;t relevant to the requested page.<\/p>\n<p>The new Unique CSS feature, now available in the LSCache for WordPress Plugin, allows users to discard this code and load only the necessary CSS to make the page display properly.<\/p>\n<h2 id=\"what-is-unique-css\">What is Unique CSS?<\/h2>\n<p>If you&#8217;ve ever examined the CSS files that are included with your chosen WordPress theme and plugins, you may have noticed &#8212; they&#8217;re very large. Why is this?<\/p>\n<p>Well, they must contain every CSS definition for every variant of every page on your site.<\/p>\n<p>Let&#8217;s say you open your site in your browser and are looking at your About page. If you open up the code, most of the code being loaded for that page isn&#8217;t relevant to the page. This means your browser has to request all this code, then sift through it and show only the relevant bits. This takes time, even for a super-fast PC on a lighting fast internet connection.<\/p>\n<p>With Unique CSS, a separate and single CSS file is created for each page on your site, where the only defined styles used are the ones required to load the content on the page being requested, thus lowering the amount of code the browser has to sift through, therefore lowering the load time.<\/p>\n<p class=\"p1\"><b>Exciting News: Introducing Our fastest <\/b><a href=\"https:\/\/chemicloud.com\/managed-wordpress-hosting?utm_source=blog&amp;utm_medium=article#60b65e4e63b58\"><b>WordPress Hosting<\/b><\/a><b> stack <\/b><span class=\"s1\">\ud83d\ude80<\/span><b> Ready for speed? Try it for just $1!<\/b><\/p>\n<h2 id=\"how-to-enable-unique-css-in-litespeed-cache\">How to Enable Unique CSS in LiteSpeed Cache<\/h2>\n<p>Enabling Unique CSS is pretty easy, however, you do need a domain key from Quic.Cloud to use the Unique CSS feature of the plugin. Don&#8217;t worry, this is super easy to do and it doesn&#8217;t mean you need to change anything on your site or CDN.<\/p>\n<p><strong>Step 1:<\/strong> Login to your \/wp-admin and in the menu on the left, hover over the LiteSpeed Cache option. Then, in the little menu that pops out, click General.<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6626\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14.png\" alt=\"\" width=\"336\" height=\"466\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14.png 844w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14-216x300.png 216w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14-564x783.png 564w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14-768x1066.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14-36x50.png 36w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14-43x60.png 43w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/1-14-72x100.png 72w\" sizes=\"auto, (max-width: 336px) 100vw, 336px\" \/><\/a><\/p>\n<p><strong>Step 2:<\/strong> When the General Settings page opens, look for the Domain Key Section.<\/p>\n<p>Click Request Domain Key.<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6627\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9.png\" alt=\"\" width=\"1918\" height=\"736\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9.png 1918w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9-300x115.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9-783x300.png 783w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9-768x295.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9-50x19.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9-1536x589.png 1536w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9-60x23.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/2-9-100x38.png 100w\" sizes=\"auto, (max-width: 1918px) 100vw, 1918px\" \/><\/a><\/p>\n<p>After clicking Request Domain Key, your page will reload and you will see this message at the top of the page:<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6628\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8.png\" alt=\"\" width=\"1918\" height=\"581\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8.png 1918w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8-300x91.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8-783x237.png 783w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8-768x233.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8-50x15.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8-1536x465.png 1536w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8-60x18.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/3-8-100x30.png 100w\" sizes=\"auto, (max-width: 1918px) 100vw, 1918px\" \/><\/a><\/p>\n<p>If you wait about a minute, maybe two, then refresh the page again, you&#8217;ll note the Domain Key field is filled with ***. This means you have a domain key from Quic.Cloud!<\/p>\n<p>Your domain key field will look like this when your key has been issued:<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6629\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9.png\" alt=\"\" width=\"1918\" height=\"788\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9.png 1918w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9-300x123.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9-783x322.png 783w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9-768x316.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9-50x21.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9-1536x631.png 1536w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9-60x25.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/4-9-100x41.png 100w\" sizes=\"auto, (max-width: 1918px) 100vw, 1918px\" \/><\/a><\/p>\n<p><strong>Step 3:<\/strong> Now, to enable Unique CSS, return to the menu on the left and look for LiteSpeed Cache &gt; Page Optimization.<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6630\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6.png\" alt=\"\" width=\"239\" height=\"727\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6.png 391w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6-99x300.png 99w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6-257x783.png 257w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6-16x50.png 16w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6-20x60.png 20w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/5-6-33x100.png 33w\" sizes=\"auto, (max-width: 239px) 100vw, 239px\" \/><\/a><\/p>\n<p><strong>Step 4:<\/strong> Once the Page Optimization settings have loaded, look for the Generate UCSS option and click the On Setting.<\/p>\n<p>Then click Save Changes in the top right corner.<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6631\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5.png\" alt=\"\" width=\"1918\" height=\"1012\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5.png 1918w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5-300x158.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5-783x413.png 783w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5-768x405.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5-50x26.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5-1536x810.png 1536w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5-60x32.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/6-5-100x53.png 100w\" sizes=\"auto, (max-width: 1918px) 100vw, 1918px\" \/><\/a><\/p>\n<p><strong>Step 5:<\/strong> Now you need to enable Cache Mobile because CSS for mobile views is different than the desktop views. To do this, navigate to the Cache option in the LiteSpeed menu on the left.<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/7-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6632\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/7-5.png\" alt=\"\" width=\"189\" height=\"686\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/7-5.png 322w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/7-5-83x300.png 83w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/7-5-216x783.png 216w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/7-5-14x50.png 14w\" sizes=\"auto, (max-width: 189px) 100vw, 189px\" \/><\/a><\/p>\n<p><strong>Step 6:<\/strong> Once the Cache Settings page has opened, look for the Cache Mobile option. Click On to enable the feature, then click Save Changes in the top right corner.<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6633\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2.png\" alt=\"\" width=\"1918\" height=\"1715\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2.png 1918w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2-300x268.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2-783x700.png 783w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2-768x687.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2-50x45.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2-1536x1373.png 1536w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2-60x54.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/8-2-100x89.png 100w\" sizes=\"auto, (max-width: 1918px) 100vw, 1918px\" \/><\/a><\/p>\n<p><strong>Step 7:<\/strong> Now you need to Purge your existing Caches. To do this, hover over the LiteSpeed icon in the top menu and choose Purge All.<\/p>\n<p><a href=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/9-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6634\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/9-3.png\" alt=\"\" width=\"624\" height=\"346\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/9-3.png 624w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/9-3-300x166.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/9-3-50x28.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/9-3-60x33.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/08\/9-3-100x55.png 100w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/a><\/p>\n<p>From this moment forward, anytime someone visits your site, the Unique CSS for that page will be served. If the UCSS hasn&#8217;t been calculated, it will be added to a queue to be generated via Cron later on.<\/p>\n<p>Congrats!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You probably take a lot of pride in the appearance of your website. Maybe you&#8217;ve spent a lot of time (and\/or money) on customizing your website to give it a unique look. Unless you&#8217;ve been working with the code directly, you may not know this, but your website&#8217;s appearance is&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[191],"ht-kb-tag":[],"class_list":["post-6624","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-website-speed"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/6624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=6624"}],"version-history":[{"count":6,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/6624\/revisions"}],"predecessor-version":[{"id":8468,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/6624\/revisions\/8468"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=6624"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=6624"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=6624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}