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

196 天前
 14c0r3y

做了一个 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

1228 次点击
所在节点    分享创造
2 条回复
ttkit
196 天前
学习了👍
14c0r3y
182 天前
刚刚给 favicon-stealer 更新了 1.8 版本,加入了更多参数:src/alt/preferSrc ,支持直接传入图片的地址(本地/网络),并且将首选的 fallback 服务改为了 favicon.im

好用程度大大提升,有本地资源 favicon 图的不用再写 if-else 啦!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1114651

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX