{"id":27062718,"url":"https://github.com/imufeng/vite-plugin-font-optimization","last_synced_at":"2025-04-05T15:19:14.348Z","repository":{"id":40694444,"uuid":"468634692","full_name":"iMuFeng/vite-plugin-font-optimization","owner":"iMuFeng","description":"Automatically inline font CSS to improvement FCP and LCP","archived":false,"fork":false,"pushed_at":"2022-09-05T06:28:32.000Z","size":339,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T13:56:59.552Z","etag":null,"topics":["googlefonts","typekit","vite","vite-plugin","webfonts"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/iMuFeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-11T06:25:40.000Z","updated_at":"2022-12-31T14:02:23.000Z","dependencies_parsed_at":"2022-09-15T02:22:35.142Z","dependency_job_id":null,"html_url":"https://github.com/iMuFeng/vite-plugin-font-optimization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iMuFeng%2Fvite-plugin-font-optimization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iMuFeng%2Fvite-plugin-font-optimization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iMuFeng%2Fvite-plugin-font-optimization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iMuFeng%2Fvite-plugin-font-optimization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iMuFeng","download_url":"https://codeload.github.com/iMuFeng/vite-plugin-font-optimization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353733,"owners_count":20925333,"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","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":["googlefonts","typekit","vite","vite-plugin","webfonts"],"created_at":"2025-04-05T15:19:13.750Z","updated_at":"2025-04-05T15:19:14.335Z","avatar_url":"https://github.com/iMuFeng.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vite Font Optimization\n\nVite Font Optimization will automatically inline font CSS to improvement [First Contentful Paint (FCP)](https://web.dev/fcp/) and [Largest Contentful Paint (LCP)](https://vercel.com/blog/core-web-vitals#largest-contentful-paint). For example:\n\n```js\n// Before\n\u003clink\n  href=\"https://fonts.googleapis.com/css2?family=Inter\u0026display=optional\"\n  rel=\"stylesheet\"\n/\u003e\n\n// After\n\u003cstyle data-href=\"https://fonts.googleapis.com/css2?family=Inter\u0026display=optional\"\u003e\n  @font-face{font-family:'Inter';font-style:normal...\n\u003c/style\u003e\n```\n\n### Installation\n\n\nInstall the plugin with `npm install vite-plugin-font-optimization` or `yarn add vite-plugin-font-optimization`\n\n## Usage\n\nAdd the plugin to `vite.config.ts` or `vite.config.js`.\n\n```js\nimport fontOptimizationPlugin from 'vite-plugin-font-optimization'\n\nexport default {\n  plugins: [fontOptimizationPlugin()]\n}\n```\n\nVite Font Optimization currently supports Google Fonts and Typekit. If you want to support additional fonts, you can set up `providers` like this below:\n\n```js\nimport fontOptimizationPlugin from 'vite-plugin-font-optimization'\n\nexport default {\n  plugins: [fontOptimizationPlugin({\n    providers: ['https://fontlibrary.org//face/']\n  })]\n}\n```\n\n## Tests\n\nTests are using jest, to run the tests use:\n\n```bash\n$ npm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimufeng%2Fvite-plugin-font-optimization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimufeng%2Fvite-plugin-font-optimization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimufeng%2Fvite-plugin-font-optimization/lists"}