I need list of all class name of Font-Awesome

前端 未结 18 3027
傲寒
傲寒 2020-12-12 13:44

I build app that will present a lot of icons so I need list of all Font-Awesome class name like [\"fa-dropbox\",\"fa-rocket\",\"fa-globe\", ....] so on is ther

18条回答
  •  伪装坚强ぢ
    2020-12-12 14:16

    Using PHP and the official icons.json file:

    function fa_icons () {
        $content = file_get_contents('https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/advanced-options/metadata/icons.json');
        $json = json_decode($content);
        $icons = [];
    
        foreach ($json as $icon => $value) {
            foreach ($value->styles as $style) {
                $icons[] = 'fa'.substr($style, 0 ,1).' fa-'.$icon;
            }
        }
    
        return $icons;
    }
    

    Returns:

    Array
    (
        [0] => fab fa-500px
        [1] => fab fa-accessible-icon
        [2] => fab fa-accusoft
        [3] => fas fa-address-book
        [4] => far fa-address-book
        [5] => fas fa-address-card
        ...
    

提交回复
热议问题