Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Tree-shake CSS selectors for HTML elements that target non-active languages #1221
In Twenty Seventeen there is about 5KB+ of rules with selectors to add styles that are specific to various languages:
Based on the site's locale, we should only include the rules that are relevant. In other words, this is attribute-based tree-shaking for the root element. It doesn't really make sense for all of these to be always served in the CSS. Note that amp-bind'ed
The changes in this PR reduce the resulting CSS size from 33,129 bytes down to 27,741 bytes on an example page in English, a 16% reduction.
Good idea to remove all of these
html[lang] rules. I didn't know there were so many.
This worked as expected locally. There are no extra language rules with this PR when using Native AMP with Twenty Seventeen, where there were several before: