{"id":16032902,"url":"https://github.com/silverwind/vite-string-plugin","last_synced_at":"2026-04-21T02:13:11.182Z","repository":{"id":179556870,"uuid":"663690738","full_name":"silverwind/vite-string-plugin","owner":"silverwind","description":"Vite plugin to import files as string, with zero dependencies","archived":false,"fork":false,"pushed_at":"2026-04-10T00:36:04.000Z","size":630,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-10T02:40:50.415Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silverwind.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2023-07-07T22:13:36.000Z","updated_at":"2026-04-10T00:36:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0695d08-d96c-4c8d-8999-398a563937c6","html_url":"https://github.com/silverwind/vite-string-plugin","commit_stats":null,"previous_names":["silverwind/vite-string-plugin"],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/silverwind/vite-string-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fvite-string-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fvite-string-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fvite-string-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fvite-string-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silverwind","download_url":"https://codeload.github.com/silverwind/vite-string-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silverwind%2Fvite-string-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32073500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T01:35:38.224Z","status":"online","status_checked_at":"2026-04-21T02:00:06.111Z","response_time":128,"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":"2024-10-08T21:41:07.456Z","updated_at":"2026-04-21T02:13:11.144Z","avatar_url":"https://github.com/silverwind.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-string-plugin\n[![](https://img.shields.io/npm/v/vite-string-plugin.svg?style=flat)](https://www.npmjs.org/package/vite-string-plugin) [![](https://img.shields.io/npm/dm/vite-string-plugin.svg)](https://www.npmjs.org/package/vite-string-plugin) [![](https://packagephobia.com/badge?p=vite-string-plugin)](https://packagephobia.com/result?p=vite-string-plugin)\n\nVite plugin to import files as string, with zero dependencies\n\n## Usage\n\n#### vite.config.js\n\n```js\nimport {defineConfig} from \"vite\";\nimport {stringPlugin} from \"vite-string-plugin\";\n\nexport default defineConfig({\n  plugins: [\n    stringPlugin(),\n  ],\n});\n```\n#### file.js\n\n```js\nimport foo from \"./foo.svg\";\n```\n\n## Options\n\n- `match`: Regex to match the path against. Default: `/\\.(svg|md|xml|txt)$/i`.\n\n## Typescript\n\nIf the default file extensions cover your needs, add `vite-string-plugin/types` to your `types` in `tsconfig.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"types\": [\n      \"vite-string-plugin/types\"\n    ]\n  }\n}\n```\n\nAlternatively, you can add ambient type declarations for each file extension:\n\n```ts\ndeclare module \"*.svg\" {\n  const value: string;\n  export default value;\n}\ndeclare module \"*.md\" {\n  const value: string;\n  export default value;\n}\ndeclare module \"*.xml\" {\n  const value: string;\n  export default value;\n}\ndeclare module \"*.txt\" {\n  const value: string;\n  export default value;\n}\n```\n\n## Related\n\n- [`vite-yaml-plugin`](https://github.com/silverwind/vite-yaml-plugin)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Fvite-string-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilverwind%2Fvite-string-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilverwind%2Fvite-string-plugin/lists"}