Skip to content

Instantly share code, notes, and snippets.

@sbatson5
Created August 24, 2020 19:08
Show Gist options
  • Save sbatson5/347a896e81e25afebd20fa5bea4c8125 to your computer and use it in GitHub Desktop.
Save sbatson5/347a896e81e25afebd20fa5bea4c8125 to your computer and use it in GitHub Desktop.
const FONT_FACES = `@font-face {
font-display: auto;
font-family: "Elections-Publico";
font-style: normal;
font-weight: 800;
src: url("https://some-url.com/fonts/Publico-Bold.woff") format("woff");
}
@font-face {
font-display: auto;
font-family: "Elections-Akkurat-Mono";
font-style: normal;
font-weight: 400;
src: url("https://some-url.com/fonts/akkurat-mono.woff") format("woff");
}`;
setupFontFaces() {
if (document.querySelector('style[data-description="newshour-components-font-faces"]')) {
return;
}
const style = document.createElement('style');
style.dataset.description = 'newshour-components-font-faces';
style.appendChild(document.createTextNode(FONT_FACES));
document.head.appendChild(style);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment