How to host material icons offline?

后端 未结 19 2504
无人及你
无人及你 2020-12-02 06:55

My apologies if this is a very simple question, but how do you use google material icons without a



        
19条回答
  •  感动是毒
    2020-12-02 07:33

    Use material-design-icons-iconfont

    Full disclosure, I'm the author of this package

    Google's material-design-icons project is on low maintenance and out of date for a while. There's a gap between the version in https://material.io/icons/ and the version in material-design-icons.

    I've created material-design-icons-iconfont to address these major issues:

    • material-design-icons jams npm install - all irrelevant svg/xml/... files has been removed
    • Font files are always up-to-date straight from Google Fonts CDN
    • Support for scss

    Install via npm

    npm install material-design-icons-iconfont --save
    

    It depends on how you pack your web application (webpack/gulp/bower/...), you'll need to import the .css/.scss file (and might change the relative fonts path)


    Import Using SCSS

    Import in one of your sass files

    $material-design-icons-font-path: '~material-design-icons-iconfont/dist/fonts/';
    @import '~material-design-icons-iconfont/src/material-design-icons';
    

    Later on, reference your desired icon + icon-id +

    contact_support
    
    • read the full instructions on material-design-icons-iconfont for more import methods

    Demo page

    It comes with a light demo page to assist searching and copy-pasting fonts

    image

提交回复
热议问题