{"id":28831444,"url":"https://github.com/daun/vite-plugin-font-manifest","last_synced_at":"2025-10-25T21:46:49.512Z","repository":{"id":299614053,"uuid":"1003059012","full_name":"daun/vite-plugin-font-manifest","owner":"daun","description":"Add font information to Vite build manifests","archived":false,"fork":false,"pushed_at":"2025-06-17T11:56:12.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-17T12:41:41.789Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daun.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-16T14:58:46.000Z","updated_at":"2025-06-17T11:55:41.000Z","dependencies_parsed_at":"2025-06-17T12:52:53.798Z","dependency_job_id":null,"html_url":"https://github.com/daun/vite-plugin-font-manifest","commit_stats":null,"previous_names":["daun/vite-plugin-font-manifest"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/daun/vite-plugin-font-manifest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fvite-plugin-font-manifest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fvite-plugin-font-manifest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fvite-plugin-font-manifest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fvite-plugin-font-manifest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daun","download_url":"https://codeload.github.com/daun/vite-plugin-font-manifest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fvite-plugin-font-manifest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281026273,"owners_count":26431753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-19T06:39:45.088Z","updated_at":"2025-10-25T21:46:49.507Z","avatar_url":"https://github.com/daun.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vite Font Manifest Plugin\n\nA Vite plugin for adding font information to the build manifest.\n\nUseful for optimizing font loading by generating preload hints or inlining the\nfont-face CSS declarations.\n\n## Example\n\n**Before**\n\n\n```json\n{\n  \"src/fonts/Inter-Regular.woff2\": {\n    \"file\": \"assets/Inter-Regular-CnZ_CWUo.woff2\",\n    \"src\": \"src/fonts/Inter-Regular.woff2\"\n  }\n}\n```\n\n**After**\n\n```json\n{\n  \"src/fonts/Inter-Regular.woff2\": {\n    \"file\": \"assets/Inter-Regular-CnZ_CWUo.woff2\",\n    \"src\": \"src/fonts/Inter-Regular.woff2\",\n    \"fontFace\": {\n      \"family\": \"Inter\",\n      \"weight\": \"400\",\n      \"style\": \"normal\",\n      \"mime\": \"font/woff2\",\n      \"css\": \"@font-face { /* */ }\",\n      \"definedIn\": [\"src/css/display.css\"]\n    }\n  }\n}\n```\n\n## Install\n\nUsing npm:\n\n```console\nnpm install vite-plugin-font-manifest --save-dev\n```\n\n## Usage\n\n### Generating the manifest\n\nAdd the plugin to your `vite.config.js` file.\n\n```js\nimport { defineConfig } from 'vite'\nimport fontManifest from 'vite-plugin-font-manifest'\n\nexport default defineConfig({\n    plugins: [\n        fontManifest(),\n    ]\n})\n```\n\n### Preloading fonts\n\nTo preload fonts, parse the build manifest and add `\u003clink rel=preload\u003e` tags for each font. This\nexample is written in Twig and  limits preloading to `woff2` fonts for modern browsers.\n\n```twig\n{% for src, entry in manifest %}\n  {% if entry.fontFace is defined and entry.fontFace.format == 'woff2' %}\n    \u003clink rel=\"preload\" href=\"/build/{{ entry.file }}\" as=\"font\" type=\"{{ entry.fontFace.mime }}\" crossorigin=\"anonymous\" /\u003e\n  {% endif %}\n{% endfor %}\n```\n\nYou can optionally also inline the original font-face declaration in a `\u003cstyle\u003e` tag as fallback for\nbrowsers that do not support preloading.\n\n```twig\n{% for src, entry in manifest %}\n  {% if entry.fontFace is defined %}\n    \u003cstyle\u003e{{ entry.fontFace.css }}\u003c/style\u003e\n  {% endif %}\n{% endfor %}\n```\n\n## Options\n\nThe plugin currently accepts no options. Feel free to open an issue if you need additional flags.\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fvite-plugin-font-manifest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaun%2Fvite-plugin-font-manifest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fvite-plugin-font-manifest/lists"}