{"id":14306,"date":"2019-09-25T09:44:02","date_gmt":"2019-09-25T09:44:02","guid":{"rendered":"https:\/\/ampforwp.com\/tutorials\/?post_type=ht_kb&#038;p=14306"},"modified":"2020-03-02T11:44:44","modified_gmt":"2020-03-02T11:44:44","slug":"what-is-tree-shaking-optimize-css-in-amp","status":"publish","type":"ht_kb","link":"https:\/\/ampforwp.com\/tutorials\/article\/what-is-tree-shaking-optimize-css-in-amp\/","title":{"rendered":"What is Tree Shaking (Optimize CSS) in AMP"},"content":{"rendered":"\n<p>CSS Tree Shaking will automatically remove all the unused CSS to bring the total under 50KB limit on the AMP pages, So if you want to optimize your CSS then follow these steps <\/p>\n\n\n\n<ul><li>You will find this option in the <strong>WordPress Dashboard<\/strong> -&gt; <strong>AMP option panel<\/strong> -&gt; <strong>Settings<\/strong> -&gt; <strong>Performance<\/strong> -&gt; Enable &#8220;<strong>Optimize CSS(beta)<\/strong>&#8221; option and then click on the &#8220;<strong>Save Changes<\/strong>&#8221; button.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"478\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/15-1024x478.png\" alt=\"\" class=\"wp-image-16237\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/15.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/15-300x140.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/15-768x359.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/15-50x23.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/15-60x28.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2020\/02\/15-100x47.png 100w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul><li><strong>Optimize CSS(beta):<\/strong> Once you enable this option it will remove unused CSS  and reduces the size of the CSS.<\/li><li><strong>Want to clear the Cache?<\/strong>: Just click this option and hit save and it will automatically clear the Cache.<\/li><li>If you want to check how much CSS is optimized then you need to enable &#8220;<strong>Dev Mode in AMP<\/strong>&#8216;  option. You will find this option in the <strong>WordPress Dashboard<\/strong> -&gt; <strong>AMP option panel<\/strong> -&gt; <strong>Settings<\/strong> -&gt; <strong>Advanced Settings<\/strong> -&gt; Enable &#8220;<strong>Dev Mode in AMP<\/strong> &#8221; option.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"188\" src=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5-1024x188.png\" alt=\"\" class=\"wp-image-14317\" srcset=\"https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5-1024x188.png 1024w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5-300x55.png 300w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5-768x141.png 768w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5-50x9.png 50w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5-60x11.png 60w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5-100x18.png 100w, https:\/\/ampforwp.com\/tutorials\/wp-content\/uploads\/2019\/09\/2-5.png 1346w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p style=\"background-color: #ffdddd; border-left: 2px solid #f44336; padding:10px;\"><strong>Note:<\/strong> Once you check the optimization then make sure you disable the &#8221; Dev Mode in AMP &#8221; option. <\/p>\n\n\n\n<p><strong>That\u2019s it for this tutorial!!<\/strong><\/p>\n\n\n\n<p>We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.<\/p>\n<div id=\"div-1\" class=\"hkb-feedback\">\n\t\t\t<strong class=\"ht-mobile-exit__title\">Ask your Questions Directly!<\/strong><br>\n\t\t\t<div class=\"hkb_widget_exit__content\" style=\"font-size: 14px;\">If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!<\/div>\n\t\t\t<a href=\"https:\/\/ampforwp.com\/support\/#contact\" id=\"button\" target=\"_blank\" rel=\"noopener noreferrer\"><button>Yes, I have a Question<\/button><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>CSS Tree Shaking will automatically remove all the unused CSS to bring the total under 50KB limit on the AMP pages, So if you want to optimize your CSS then follow these steps You will find this option in the WordPress Dashboard -&gt; AMP option panel -&gt; Settings -&gt; Performance&#8230;<\/p>\n","protected":false},"author":18,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[1],"ht-kb-tag":[],"_links":{"self":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/14306"}],"collection":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/comments?post=14306"}],"version-history":[{"count":27,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/14306\/revisions"}],"predecessor-version":[{"id":16696,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/14306\/revisions\/16696"}],"wp:attachment":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/media?parent=14306"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-category?post=14306"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-tag?post=14306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}