Skip to content

Best practice to add fonts into a web component #2125

Answered by bennypowers
Alos asked this question in Q&A
Discussion options

You must be logged in to vote

From https://www.npmjs.com/package/@material/mwc-icon:

<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet">

<mwc-icon>shopping_cart</mwc-icon>

<script type="module">
  import '@material/mwc-icon';
</script>

Just a <link> in the <head> of index.html is enough

Replies: 5 comments 17 replies

Comment options

You must be logged in to vote
9 replies
@bennypowers
Comment options

@Alos
Comment options

@luas10c
Comment options

@erikomis
Comment options

@DevilANANDGupta
Comment options

Answer selected by Alos
Comment options

You must be logged in to vote
3 replies
@erikomis
Comment options

@DevilANANDGupta
Comment options

@abenkoula71
Comment options

Comment options

You must be logged in to vote
2 replies
@luas10c
Comment options

@rivinduchamath
Comment options

Comment options

You must be logged in to vote
2 replies
@luas10c
Comment options

@erikomis
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
8 participants
Converted from issue

This discussion was converted from issue #2123 on March 31, 2021 15:48.