Support » Plugin: PhastPress » [Inlines critical CSS] Some unused css not removed

  • Resolved hz_i3

    (@hz_i3)


    Inlines critical CSS is very cool and does cut unused css for HTML elements not present on the page, but some of them are not removed.

    For example, #start-resizable-editor-section{display:none} is not removed. So it seems it can’t remove some and also some advanced CSS with selectors (e.g., :not).

    Is there any detailed information about this?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Albert Peschar

    (@kiboit)

    Hi @hz_i3,

    The CSS removal only looks at class names (.class selectors) and ignores any selectors involving parentheses (eg, :not(...)).

    Even though this is quite limited, it’s enough to remove most unused CSS. There’s no harm in a few additional unused CSS rules being inlined, as long as the total amount of inlined CSS stays relatively small.

    –Albert

    Yeah, .class are the most popular ones.

    CSS rules with the selectors are probably harder to remove and error-prone? The twenty-twenty default theme and the block editor are using advanced selectors a lot.

    The twenty-twenty default theme: https://wp-themes.com/wp-content/themes/twentytwenty/style.css

    Block editor: https://wp-themes.com/wp/wp-includes/css/dist/block-library/style.css

    Plugin Author Albert Peschar

    (@kiboit)

    Hi @hz_i3,

    Many unused selectors remain in the inlined CSS. It wouldn’t be too hard to support :not(...) and #id-based selectors as well. I’ll add this to my to-do list–but it’s certain to take a while before I get to it.

    Thanks for your feedback!

    –Albert

    Thanks, Albert. I am glad my feedback helps. I am looking forward for the support to remove more unused CSS.

    This plugin is the only plugin that I found works to remove unused CSS. I just added a 5-star review. Thanks for the work!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Inlines critical CSS] Some unused css not removed’ is closed to new replies.