I've noticed that in the source code of my website there is Font Awesome loaded five times. Loaded versions are 3.2.1, 4.0.1, 4.1.0 and more. Shortcodes plugins, page builders, the theme and/or plugins designed to load Font Awesome like Better Font Awesome load its own version of this.
The theme I'm using loads it this way:
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css', array(), '4.1.0' );
But its previous version used to use this:
wp_enqueue_style( 'themename-fontawesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css' );
Plugins use various hooks and formats:
wp_enqueue_style( 'pluginname-fontawesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css', array(), '4.0.1' );
wp_enqueue_style( 'pluginname-fontawesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css' );
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css', array(), '3.2.1' );
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css' );
I'm developing a plugin and I initially wanted to load Font Awesome with this:
wp_enqueue_style( 'my-plugin-name-fontawesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css', array(), '4.1.0' );
But then I came to conclusion that the most correct way to load it would be this:
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/fontawesome/font-awesome.min.css', array(), '4.1.0' );
Can someone confirm what would be the best naming standard for loading this in my plugin and if it's possible at all to stop other plugins from loading their versions of that if my version is the newest one?
I don't want to have Font Awesome loaded 5 times (30kB each) and some older versions should not be loaded but I'd like to keep using the theme, shortcodes plugins and page builders that I'm currently using.