Script to fetch a doc's icon from its website
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 32/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- nodejs
研究方向
Start with the PR template and the existing public/icons/docs/<slug>/ layout to see the three files the script must write (16.png, [email protected], SOURCE), then find where npm scripts and the Node tests and type check are configured. The work covers HTML icon-tag discovery, PNG and ICO parsing, and alpha-aware downscaling, so read the draft PR #2781 before writing anything. Done means the script works for the three example sites and the tests pass, but the maintainer has not yet confirmed the approach.
由索引模型根據 Issue 內容生成。
描述
Feature request
Summary
A small script that fetches a doc's icon from the documented project's website and saves it the way DevDocs expects:
npm run icon -- <doc_slug> <website>
It writes public/icons/docs/<slug>/16.png, [email protected] and SOURCE, the three files the PR template asks for.
Today, each new doc's icon is found, resized to 16 and 32 pixels and saved by hand. The script does that step for contributors and keeps the SOURCE file accurate. It also helps when updating a doc whose icon has changed.
How it works:
- It looks for the icon in the page's
<link rel="icon">and<link rel="apple-touch-icon">tags, trying the smallest one that is at least 32 pixels first. If none works, it tries/apple-touch-icon.pngand/favicon.ico. - It reads PNG files and ICO files, including ICO files that contain bitmaps rather than PNGs.
- It scales the icon by averaging pixels with premultiplied alpha, so 16-pixel icons stay crisp and transparent edges don't darken.
- It uses only Node's standard library, so there are no new dependencies. It sits beside the existing Node tests and type check.
- SVG-only icons can't be converted without a dependency, so the script says so.
--icon <image address>then uses a specific PNG or ICO instead.
Contributors should still check the result at 16 pixels, as they do today. The script only automates finding, resizing and recording the source.
I've prepared an implementation with tests in draft PR #2781. Would you be open to this? I'm happy to change the approach, for example to a thor task.
Examples
Tried on real sites:
npm run icon -- python https://www.python.orgsaves the icon from/static/apple-touch-icon-precomposed.png.npm run icon -- github https://docs.github.comsaves the icon from/assets/cb-345/images/site/favicon.png.npm run icon -- vue https://vuejs.orgexplains that the site only offerslogo.svg, and suggests--icon.
- 主要語言
- Ruby
- 星號
- 39.6k
- 分支
- 2.7k
- 平均合併
- 21 小時 1 分鐘
- 30 天內合併 PR
- 21
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
freeCodeCamp/devdocs 的其他 Issue
-
docs/improvement
難度 2/5 1-3 小時 新手友好度 62/100
freeCodeCamp/devdocs#1989 · 4 則留言 · 4 個 reaction ·
維護者通常 1 天內回覆
-
sidebar未關閉feature
難度 4/5 3-5 天 新手友好度 22/100
freeCodeCamp/devdocs#2776 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 8/100
freeCodeCamp/devdocs#2746 ·
維護者通常 1 天內回覆
-
docs/update
難度 5/5 一週以上 新手友好度 20/100
freeCodeCamp/devdocs#2744 · 2 則留言 ·
維護者通常 1 天內回覆
-
feature
難度 5/5 一週以上 新手友好度 30/100
freeCodeCamp/devdocs#2683 · 1 則留言 ·
維護者通常 1 天內回覆
查看 freeCodeCamp/devdocs 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
-
Add a dark mode未關閉accessibility enhancement good first issue
難度 2/5 1-3 小時 新手友好度 82/100
samiromer2/Ruby-Consent-Portal#35 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
-
bug detail
難度 2/5 1-3 小時 新手友好度 77/100
keygen-sh/keygen-api#1161 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆