-
Notifications
You must be signed in to change notification settings - Fork 216
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
font-awesome enqueue_style name causes duplicate include of css library #2198
Comments
Is this resolved? It's Jan 8 2018 and I still see multiple font-awesome files being downloaded to my browser, including Unyson's. For me it adds up to essentially a useless 60kb extra on every page load. I have latest versions for WP and all plugins. |
@TheMangoTrain check your theme provider, Unyson issue has been resolved and handle is font-awesome as seen here ThemeFuse/Unyson-Feedback-Extension@114b639#diff-d9562dc9a0e305f53a6ef22cedcf5d40R151 |
Due to the use of prefix fw-font-awesome within wp_enqueue_style(), if using font-awesome from other plugins or themes, the css libraries are duplicated and parsed to source.
WordPress is nifty in that if properly en-queuing scripts, they won't be duplicated, WP relies on the $handle parameter of
wp_enqueue_style()
to perform this check and avoid parsing duplicate libraries.For example, the plugin Revslider uses font-awesome, as does user-role-editor and many other WP plugins. But they all enqueue 'font-awesome', without any prefixes, so only one instance of the library is ever loaded (highest version, is always loaded).
Several Unyson extensions reference this fw-font-awesome handle, but in our case, we only use megamenu.
We modified
/wp-content/plugins/unyson/framework/extensions/megamenu/static.php
, changing:to
This change resolved the duplicate css inclusion issue for us. Obviously other references to fw-font-awesome should be updated to use only "font-awesome", allowing WordPress itself to determine best version to use.
Just imagine the performance nightmare if every plugin included its own instance of jQuery (or other widely used libs). Unless this Unyson font-awesome library is customized, it makes little sense to include it as its own standalone version.
This is a revision request.
The text was updated successfully, but these errors were encountered: