Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow [bw_dash] to enqueue the font only #2

Closed
bobbingwide opened this issue Feb 16, 2016 · 2 comments
Closed

Allow [bw_dash] to enqueue the font only #2

bobbingwide opened this issue Feb 16, 2016 · 2 comments
Assignees

Comments

@bobbingwide
Copy link
Owner

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 bobbingwide self-assigned this Jan 4, 2017
@bobbingwide
Copy link
Owner Author

bobbingwide commented Jan 13, 2017

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
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant