I am trying to build wordpress plugin with polymer at admin side. Polymer use link element to import the library. However wp function “wp_enqueue_style” is missing setting up rel attribute. This is from the official doc (link):
wp_enqueue_style( $handle, $src, $deps, $ver, $media );
There is a function named “wp_style_add_data” but I tried to set rel attribute in this way without any luck:
wp_enqueue_style('polymer_html', plugin_dir_url(__FILE__).'../js/bower_components/polymer/polymer.html', array(), '1.0', 'all');
wp_style_add_data('polymer_html', 'rel', 'import'); //this way
wp_style_add_data('polymer_html', 'import', true); //and also this way
Here is example of importing polymer:
<link rel="import" href="bower_components/polymer/polymer.html">
I was developing wp plugins long time ago, so I would appreciate your help to find a best workaround to this limitation.
You can use the
style_loader_tag
filter:Change
polymer-handle
with the actual handle.