Material-components-web-components: Allow users to define icon font themselves

Created on 16 Jan 2019  路  3Comments  路  Source: material-components/material-components-web-components

Users would like to be able to load their own icon font for the Material Icons family.
We need to determine if this should be an opt-in, or require users to load the font themselves always.

Feature Question

Most helpful comment

I've been experimenting using this with a LitElement app. I spent some time trying to do this (and also prevent FOUC). It was far easier to just use SVG. I believe this is similar to how iron-icon worked under the hood. Here is what I came up with:
https://gist.github.com/jonmann20/411f5b8de91536f9bb2561f72cbfe59a

All 3 comments

I've been experimenting using this with a LitElement app. I spent some time trying to do this (and also prevent FOUC). It was far easier to just use SVG. I believe this is similar to how iron-icon worked under the hood. Here is what I came up with:
https://gist.github.com/jonmann20/411f5b8de91536f9bb2561f72cbfe59a

Also can you provide a way to remove the dependency to the icon like PolymerElement provides for the font roboto :
window.polymerSkipLoadingFontRoboto = true;

Proposition :
window.mwcSkipLoadingIcon = true;

PolymerElement Reference :

https://github.com/PolymerElements/font-roboto/blob/master/roboto.js

mwc-icon source file to modify :

https://github.com/material-components/material-components-web-components/blob/master/packages/icon/src/mwc-icon-font.ts

What do you think @azakus ?

good solution is here https://github.com/andreasbm/weightless/tree/master/src/lib/icon#-%EF%B8%8F-load-the-icon-font

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pandres95 picture pandres95  路  4Comments

frankiefu picture frankiefu  路  4Comments

AndreasGalster picture AndreasGalster  路  5Comments

dfreedm picture dfreedm  路  3Comments

bennypowers picture bennypowers  路  4Comments