Support » Plugin: Abs - Additional block styles » Optimized Code

  • Resolved palmtek

    (@palmtek)


    Howdy,
    Does your plugin load JS and CSS all the time or only on pages/posts where it is used?
    Does it load only the code for blocks used?
    Thank you

Viewing 1 replies (of 1 total)
  • Plugin Author WebMan Design | Oliver Juhas

    (@webmandesign)

    Hi @palmtek,

    The plugin hooks onto WordPress native functionality to load the CSS code. All the CSS styles are registered as inline styles via register_block_style() function. These are being added to HTML head (by default) by WordPress itself whenever it enqueues wp-block-library stylesheet (which seems to be all the time?).

    For themes that don’t support separate block assets loading (check wp_should_load_separate_core_block_assets() function), such as Twenty Twenty-One theme, this means all plugin’s CSS styles are being inlined when wp-block-library stylesheet is enqueued by WordPress. This is roughly 23 KB of minified CSS code.

    On the other hand, when the theme supports separate block assets loading, such as Twenty Twenty-Two theme, only the CSS code for specific block styles used in the page/post content are being inlined. Plus a global CSS is always being inlined in this case, which is 420 bytes of minified CSS code on front-end.

    No JavaScript is being loaded by the plugin.

    Best regards,

    Oliver

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.