How do I add typekit fonts to a D8 theme? Having looked over the existing D8 documentation on adding JS to the &lt;head&gt; of a page, I'm still not sure how to go about it?

What is the correct way to achieve this on every page for my theme:

&lt;script src="//use.typekit.net/abc0abc.js"&gt;&lt;/script&gt;
&lt;script&gt;try{Typekit.load();}catch(e){}&lt;/script&gt;


Regarding inline JS, from the latest D8 documentation:


  In the case of front-end/styling (e.g. hosted font services), the JS
  belongs in the theme. Put the JS directly in your html.html.twig file.
  In the case of fonts, this will also allow you to put it right in the
  place that gives you the best (and fastest) end user experience,
  because it allows you to prevent a FOUT (Flash Of Unstyled Text) while
  the font is still loading (fonts loaded through JS must be listed in
  the HTML  before the CSS)!


So, I guess the inline JS goes directly into html.html.twig, but what about the external file?

I have this in my theme files, but it's not adding the external file to any pages:

mytheme.info.yml

libraries:
  - mytheme/typekit


mytheme.libraries.yml

typekit:
  version: 1.x
  js:
    //use.typekit.net/abc1abc.js: { type: external }
For put the library to the header you must user header: true, then:

mytheme.info.yml

libraries:
  - mytheme/typekit


mytheme.libraries.yml:

typekit:
  version: 1.x
  header: true
  js:
    //use.typekit.net/abc1abc.js: { every_page: true }
    js/custom.js: { every_page: true }


js/custom.js:

try { 
  Typekit.load(); 
} 
catch(e) { 
}