Script to fetch a doc's icon from its website
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 32/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- nodejs
- Bereich
- developer-experience
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Ruby
- Sterne
- 39.6k
- Forks
- 2.7k
- Ø Merge
- 21 Std. 1 Min.
- Gemergte PRs (30 T.)
- 21
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus freeCodeCamp/devdocs
-
class Data in Ruby 3.2Offendocs/improvement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
freeCodeCamp/devdocs#1989 · 4 Kommentare · 4 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
-
sidebarOffenfeature
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
freeCodeCamp/devdocs#2776 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 8/100
freeCodeCamp/devdocs#2746 ·
Maintainer antworten meist innerhalb von 1 Tag
-
docs/update
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
freeCodeCamp/devdocs#2744 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
feature
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
freeCodeCamp/devdocs#2683 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in freeCodeCamp/devdocs
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Add a dark modeOffenaccessibility enhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
samiromer2/Ruby-Consent-Portal#35 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
bug detail
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
keygen-sh/keygen-api#1161 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag