{"id":21952169,"url":"https://github.com/stefanmaric/vite-plugin-html-tags","last_synced_at":"2026-04-26T16:31:58.875Z","repository":{"id":65946673,"uuid":"594840298","full_name":"stefanmaric/vite-plugin-html-tags","owner":"stefanmaric","description":"Flexible framework to add tags to HTML entries and recipes for resource hints and more","archived":false,"fork":false,"pushed_at":"2023-11-21T18:26:20.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T12:12:49.596Z","etag":null,"topics":["build","html","plugin","preload","tags","vite","vite-plugin"],"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/stefanmaric.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":"2023-01-29T19:48:38.000Z","updated_at":"2023-03-09T15:09:18.000Z","dependencies_parsed_at":"2023-02-17T18:50:13.409Z","dependency_job_id":null,"html_url":"https://github.com/stefanmaric/vite-plugin-html-tags","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/stefanmaric/vite-plugin-html-tags","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmaric%2Fvite-plugin-html-tags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmaric%2Fvite-plugin-html-tags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmaric%2Fvite-plugin-html-tags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmaric%2Fvite-plugin-html-tags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanmaric","download_url":"https://codeload.github.com/stefanmaric/vite-plugin-html-tags/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanmaric%2Fvite-plugin-html-tags/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32305035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["build","html","plugin","preload","tags","vite","vite-plugin"],"created_at":"2024-11-29T06:24:02.568Z","updated_at":"2026-04-26T16:31:58.856Z","avatar_url":"https://github.com/stefanmaric.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-html-tags\n\nFlexible framework to add tags to HTML entries and recipes for resource hints and more\n\n## What is it?\n\nVite offers a [very convenient way](https://vitejs.dev/guide/api-plugin.html#transformindexhtml) for plugin authors to inject tags into HTML entry points. This plugin exposes these capabilities to Vite users in an even more convenient way and a set of \"recipes\" to solve common use-cases like preloading build assets.\n\n## Sneak-peek\n\n```typescript\n// vite.config.ts\n\nimport react from \"@vitejs/plugin-react-swc\"\nimport { defineConfig } from \"vite\"\nimport { PluginHtmlTags } from \"vite-plugin-html-tags\"\n\nexport default defineConfig({\n  plugins: [\n    react(),\n    PluginHtmlTags(({ env }) =\u003e [\n      {\n        tag: \"link\",\n        attrs: {\n          rel: \"preconnect\",\n          href: env.VITE_API_URL,\n        },\n      },\n    ]),\n  ],\n})\n```\n\nIn the example above a `\u003clink rel=\"preconnect\" href=\"\u003cVITE_API_URL\u003e\"\u003e` will be injected into the HTML `\u003chead\u003e`. The value of `\u003cVITE_API_URL\u003e` will be whatever Vite resolved for the project, env, and mode combination. We call such function a \"`TagGenerator`\".\n\n## Project stage\n\nAlpha: it is being tested in some projects and will enter beta stage once released to production.\n\n## Recipes\n\n\"Recipes\" are just predefined Tag Generators that help you with common chores; check the [`/lib/recipes/` folder](./lib/recipes/).\n\n### Resource Hints\n\nA recipe that allows to add [Resource Hints](https://pagespeedchecklist.com/resource-hints) to your site for any asset in the final build.\n\nExample of [font preloading](https://wp-rocket.me/blog/font-preloading-best-practices/) to reduce CLS (Cumulative Layout Shift) and prevent FOIT (Flash of Invisible Text)/FOUT, or Flash of Unstyled Text:\n\n```typescript\nimport react from '@vitejs/plugin-react-swc'\nimport { defineConfig } from 'vite'\nimport { PluginHtmlTags, buildResourceHints } from 'vite-plugin-html-tags'\n\nexport default defineConfig({\n  plugins: [\n    PluginHtmlTags([\n      react(),\n      buildResourceHints([\n        {\n          files: \"*.woff2\",\n          attrs: {\n            crossorigin: true,\n            rel: 'preload',\n          },\n        },\n      ]),\n    ]),\n  ],\n})\n\n```\n\n## TODO\n\n- [ ] More documentation\n- [ ] Tests\n- [ ] More recipes\n\n## License\n\n[MIT](./LICENSE) ♥\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanmaric%2Fvite-plugin-html-tags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanmaric%2Fvite-plugin-html-tags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanmaric%2Fvite-plugin-html-tags/lists"}