Skip to content

Instantly share code, notes, and snippets.

@VandeurenGlenn
Last active January 29, 2016 17:07
Show Gist options
  • Save VandeurenGlenn/94891b96fc576ee99600 to your computer and use it in GitHub Desktop.
Save VandeurenGlenn/94891b96fc576ee99600 to your computer and use it in GitHub Desktop.
import dynamically
function import(href, options) {
var link = document.createElement('link');
var target = options.target ? options.target : document.head;
if (options.async) {
link.setAttribute('async', '');
}
link.rel = 'import';
link.href = href;
target.appendChild(link);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment