Script to fetch a doc's icon from its website
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 32/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nodejs
- Lĩnh vực
- developer-experience
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Ruby
- Star
- 39.6k
- Fork
- 2.7k
- Merge trung bình
- 21 giờ 1 phút
- Pull request đã merge (30 ngày)
- 21
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của freeCodeCamp/devdocs
-
class Data in Ruby 3.2Đang mởdocs/improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
freeCodeCamp/devdocs#1989 · 4 bình luận · 4 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sidebarĐang mởfeature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
freeCodeCamp/devdocs#2776 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Oqerun Store listing: DevDocsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 8/100
freeCodeCamp/devdocs#2746 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs/update
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
freeCodeCamp/devdocs#2744 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
freeCodeCamp/devdocs#2683 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của freeCodeCamp/devdocs
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
swombat/souls-house#770 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
riverqueue/river#1576 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
respond_to? on a poly receiver answers true for a program class's private or protected methodĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
presidentbeef/brakeman#2063 ·