V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
14c0r3y

做了一个 npm 包 favicon-stealer,用于获取并展示网站的 favicon,内置多个 fallback,支持自定义尺寸、背景颜色、padding、border、圆角等参数

  •  
  •   14c0r3y ·
    PRO
    · Feb 27, 2025 · 1638 views
    This topic created in 431 days ago, the information mentioned may be changed or developed.

    做了一个 npm 包favicon-stealer,用于获取并展示网站的 favicon ,内置多个 fallback ,支持自定义尺寸、背景颜色、padding 、border 、圆角等参数。

    使用方法非常简单,两行代码就能用起来

    安装方法

    npm install favicon-stealer
    
    
    pnpm add favicon-stealer
    

    使用方法

    import { Favicon } from 'favicon-stealer';
    
    <Favicon url="https://example.com" />
    

    另外整个 npm 包代码已开源,欢迎有需要的朋友使用支持~

    npm 包官网地址: https://npmjs.com/package/favicon-stealer

    开源仓库地址: https://github.com/iAmCorey/favicon-stealer

    ttkit
        1
    ttkit  
       Feb 27, 2025
    学习了👍
    14c0r3y
        2
    14c0r3y  
    OP
    PRO
       Mar 13, 2025
    刚刚给 favicon-stealer 更新了 1.8 版本,加入了更多参数:src/alt/preferSrc ,支持直接传入图片的地址(本地/网络),并且将首选的 fallback 服务改为了 favicon.im

    好用程度大大提升,有本地资源 favicon 图的不用再写 if-else 啦!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1002 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 23:50 · PVG 07:50 · LAX 16:50 · JFK 19:50
    ♥ Do have faith in what you're doing.