bobbingwide / oik-blocks

WordPress 5.0 blocks for oik shortcodes
https://oik-plugins.com/oik-plugins/oik-blocks
GNU General Public License v3.0
1 stars 0 forks source link

Dashicons not being enqueued for logged out users #41

Open bobbingwide opened 3 years ago

bobbingwide commented 3 years ago

The output for the block list block ( oik-block/blocklist ) assumes that the dashicons CSS is enqueued. It appears that this is no longer the case with Gutenberg 9.1.0. The result is that the icons for blocks which use dashicons are not displayed on the front end.

It would appear that the fix to this would be to enqueue dashicons.

bobbingwide commented 2 years ago

The solution to enqueue dashicons for every page is not good for performance. Two options

  1. Change dashicons to use SVG icons
  2. Only enqueue dashicons when the dashicon block is present.

Option two would be quicker to implement. Option one would be better overall. In the mean time, the change to not enqueue dashicons needs to be undone.

bobbingwide commented 2 years ago
  1. Change dashicons to use SVG icons

We can do this for the blockicon block, but not for the blockinfo or blocklist blocks since it's not so easy to parse the HTML to find which blocks use dashicons.

  1. Only enqueue dashicons when the dashicon block is present.

Do this when we know there's a blockicon but can't determine the name of the icon from the block's registration.