How I reduce CSS size under 50KB for AMP
Here’s how I reduce CSS size under 50KB for AMP. It’s mandatory requirement from Google AMP. The short answer: remove the unused CSS codes for the page you’re going to convert to AMP.
Long answer:
Easier said than done, especially when the webpage you’re going to convert to AMP had very large CSS codes.
Read on my own story below . . .
I am getting more and more requests to build AMP pages from existing pages.
However, there are many occasions that the existing pages contain a large chunk of CSS.
The problem is, almost all of the site owners I met, ask to make their site’s AMP page to look similar to the site’s look on the mobile phones.
That makes sense.
But this also raised another big problem: AMP pages had a restriction for CSS size, 50 KB at maximum.
Not only that, it’s not allowed to load any custom external CSS.
All styles must be loaded inside the