Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.67 KB

best-practices.md

File metadata and controls

30 lines (21 loc) · 1.67 KB

Importing Font Icons

If you need to import font icons to your app, the best way is to include it as a <link> tag in the head of your document. For example if you're using Material Icons you would add this to your <head>:

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

Further details documented on Material Icons docs .

By not including the font icon inside your CSS file, it reduces the file size. By reducing CSS file size, you decrease the time to initial load since CSS files are render blocking. This does present some drawbacks -- the main issue being FOUC (Flash of unstyled content). Your users will not see the actual icons until the font icon file loads.

Use with MDC Ripple

If you load your font icons with a Ripple with the above method, you will need to set the height and width of the icons. This is because MDC Ripple calculates the ripple size from the initial height/width.

Importing packages

References:

Since classnames@2.2.6 is exporting default, we should be importing as such:

// referenced in https://github.com/basarat/typescript-book/blob/master/docs/project/external-modules.md#default-exportsimports
import classnames from 'classnames';