Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    Yes, that is an interesting article–I hadn’t thought about its implications beyond blocks, but think that it would be great to only load specific block styles instead of all of them, even for blocks which aren’t in use.

    FWIW, the stylesheet for this plugin is 2.38KB, and only enqueued if the buttons will be output, so its footprint is pretty minimal already.

    The latest version of the plugin fixed a bug which was loading the stylesheet everywhere, and some users who are placing the buttons in unexpected places without accounting for the styles are finding they aren’t loading, so I was looking into a solution along these lines, to enqueue the stylesheet at the last minute if it was registered, but not enqueued. Nathan’s approach is better than what I was doing, though, because I was encountering a FOUC. Revisiting his approach fixes that, so thank you!

    I wonder about the comment at the beginning of the Codex entry for wp_print_styles: “Since WordPress 3.3 wp_print_styles should not be used to enqueue styles or scripts.” (However, reading the link there suggests that it’s the wp_print_styles hook which should no longer be used, rather than the function, but it’s confusing.)

    I’m also not sure how this method would work with optimization plugins which combine and minify enqueued stylesheets, if there would be a conflict/issue with that.

    It’s worth looking into–thank you for bringing it to my attention!

    Thread Starter politicske

    (@politicske)

    You are welcome and it is good to know it helps you develop the plugin in a way. Since you are developer, I will leave it to you to figure it out, haha. Cheers! I use LiteSpeed Cache Plugin on a Litespeed server and indeed it combines and minifies your plugin’s CSS.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Performance’ is closed to new replies.