bobbingwide / oik-bob-bing-wide

More lazy smart shortcodes
https://www.oik-plugins.com/oik-plugins/oik-bob-bing-wide-more-lazy-smart-shortcodes/
GNU General Public License v2.0
2 stars 0 forks source link

Allow [bw_dash] to enqueue the font only #2

Closed bobbingwide closed 2 years ago

bobbingwide commented 8 years ago

If the output of a shortcode is to be cached then we have to be able to cater for side effects of shortcode expansion such as script or style enqueing. The [bw_dash] shortcode enqueues the dashicons and/or genericons fonts. If the only instance of the bw_dash shortcode is going to be cached then the fonts may not be enqueued, so the display is incorrect.

A workaround to this problem is to ensure an instance of bw_dash is always invoked. But we may not want the icon to be displayed. This may be achieved using the class parameter, setting it to a value that causes the icon to not be displayed.

E.g [bw_dash none font=dashicons class=bw_display_none]

Alternatively, the shortcode may be changed to make this easier. E.g. [bw_dash dashicons] would cause the dashicons font to be enqueued.

bobbingwide commented 7 years ago

This requirement is not so important now that https://github.com/bobbingwide/oik-widget-cache supports the caching and replaying of enqueued scripts and styles.

bw_dash already supports the class= parameter. and oik provides CSS for .hide { display:none; } so the easiest way of supporting this is to wrap the generated dash icons with the given class.

We can't simply add the class hide to the span for the dash since dashicons.css uses display: inline-block for .dashicons

We have to test that this doesn't adversely affect shortcodes which are already using the class parameter and have CSS styling that will be repeated.

bobbingwide commented 2 years ago

I believe this is no longer required. The bw_dash shortcode and Dashicon block now support SVG icons by default so the dashicons css and font aren't wanted anymore.