Skip to content

Eliminate CSS tree shaking from being optional #2501

@westonruter

Description

@westonruter

The AMP plugin settings screen has an option for whether or not to enable tree shaking:

image

This option is enabled by default:

'accept_tree_shaking' => true,

And all core themes force it to be enabled:

'removed_unused_css_rules' => true,

When tree shaking was first introduced, the idea behind this option was to guard against scenarios where the tree shaker erroneously removed rules that actually applied to the page, specifically for themes that have been crafted to not have more than 50KB of CSS. The reality is that core + themes + plugins will almost always generate more than 50KB, as evidenced by the above defaults. Also, there have been significant improvements to the tree shaker to prevent over-eager removal of rules, including:

So since this option is not really needed anymore, I suggest we remove it entirely and always perform tree shaking. Again, decisions not options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions