{"id":27102977,"url":"https://github.com/unplugin/unplugin-jsx-string","last_synced_at":"2025-10-27T13:13:35.146Z","repository":{"id":37618085,"uuid":"500335622","full_name":"unplugin/unplugin-jsx-string","owner":"unplugin","description":"Converts JSX to HTML strings at compile time.","archived":false,"fork":false,"pushed_at":"2025-04-04T21:31:39.000Z","size":997,"stargazers_count":47,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T02:01:49.532Z","etag":null,"topics":["convert","html","jsx","react","string","unplugin"],"latest_commit_sha":null,"homepage":"https://jsx-string.sxzz.moe","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/unplugin.png","metadata":{"funding":{"github":"sxzz"},"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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}},"created_at":"2022-06-06T07:34:41.000Z","updated_at":"2025-03-23T02:40:52.000Z","dependencies_parsed_at":"2023-10-20T07:47:06.788Z","dependency_job_id":"0921eca1-7160-4606-afa1-3edcb792e83e","html_url":"https://github.com/unplugin/unplugin-jsx-string","commit_stats":null,"previous_names":["unplugin/unplugin-jsx-string","sxzz/unplugin-jsx-string"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-jsx-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-jsx-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-jsx-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unplugin%2Funplugin-jsx-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unplugin","download_url":"https://codeload.github.com/unplugin/unplugin-jsx-string/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247511206,"owners_count":20950618,"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":["convert","html","jsx","react","string","unplugin"],"created_at":"2025-04-06T16:26:05.545Z","updated_at":"2025-10-27T13:13:35.127Z","avatar_url":"https://github.com/unplugin.png","language":"TypeScript","readme":"# unplugin-jsx-string\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Unit Test][unit-test-src]][unit-test-href]\n\n\nConverts JSX to HTML strings at compile time.\n\n## Installation\n\n```bash\nnpm i unplugin-jsx-string\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eVite\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// vite.config.ts\nimport JsxString from 'unplugin-jsx-string/vite'\n\nexport default defineConfig({\n  plugins: [JsxString()],\n})\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eRollup\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// rollup.config.js\nimport JsxString from 'unplugin-jsx-string/rollup'\n\nexport default {\n  plugins: [JsxString()],\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eesbuild\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// esbuild.config.js\nimport { build } from 'esbuild'\n\nbuild({\n  plugins: [require('unplugin-jsx-string/esbuild')()],\n})\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eWebpack\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// webpack.config.js\nmodule.exports = {\n  /* ... */\n  plugins: [require('unplugin-jsx-string/webpack')()],\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eVue CLI\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// vue.config.js\nmodule.exports = {\n  configureWebpack: {\n    plugins: [require('unplugin-jsx-string/webpack')()],\n  },\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n#### TypeScript Support\n\n```jsonc\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    // ...\n    \"types\": [\"unplugin-jsx-string\" /* ... */],\n  },\n}\n```\n\n## Usage\n\n```tsx\n// basic usage\njsxToString(\u003cdiv\u003eHello\u003c/div\u003e)\n// \"\u003cdiv\u003eHello\u003c/div\u003e\"\n\n// raw expression\nconst t = Date.now()\njsxToString(\u003cdiv\u003eNow: {jsxRaw(Math.trunc(t / 1000))}\u003c/div\u003e)\n// `\u003cdiv\u003eNow: ${Math.trunc(t / 1000)}\u003c/div\u003e`\n\n// class list\njsxToString(\u003cdiv className={['bar', 'foo']} /\u003e)\n// `\u003cdiv class=\"bar foo\"/\u003e`\n\n// styles\njsxToString(\u003cdiv style={{ color: 'red', textAlign: 'center' }} /\u003e)\n// `\u003cdiv style=\"color:red;text-align:center\"/\u003e`\n\n// events\njsxToString(\u003cbutton onClick={() =\u003e 'clicked'}\u003e\u003c/button\u003e)\n// \"\u003cbutton onclick=\"\u0026apos;clicked\u0026apos;\"\u003e\u003c/button\u003e\"\n\n// children\njsxToString(\n  \u003cdiv\u003e\n    \u003cp\u003efoo\u003c/p\u003e\n    \u003cp\u003ebar\u003c/p\u003e\n    \u003cbr /\u003e\n    \u003cdiv /\u003e\n    123\n  \u003c/div\u003e,\n)\n// \"\u003cdiv\u003e\u003cp\u003efoo\u003c/p\u003e\u003cp\u003ebar\u003c/p\u003e\u003cbr/\u003e\u003cdiv/\u003e123\u003c/div\u003e\"\n```\n\n## Benchmark\n\n```\n\u003cdiv\u003eHello World\u003c/div\u003e x 99,362 ops/sec ±0.55% (92 runs sampled)\n\u003cdiv\u003e\u003cimg src={'foo'} /\u003e\u003cdiv\u003e\u003c/div\u003e\u003c/div\u003e x 66,281 ops/sec ±0.63% (95 runs sampled)\n```\n\n\u003csmall\u003e\nTested on Apple M1 Max / 32GB\n\n_More samples are welcome._\n\u003c/small\u003e\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg\"\u003e\n    \u003cimg src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## License\n\n[MIT](./LICENSE) License © 2022-PRESENT [Kevin Deng](https://github.com/sxzz)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/unplugin-jsx-string.svg\n[npm-version-href]: https://npmjs.com/package/unplugin-jsx-string\n[npm-downloads-src]: https://img.shields.io/npm/dm/unplugin-jsx-string\n[npm-downloads-href]: https://www.npmcharts.com/compare/unplugin-jsx-string?interval=30\n[unit-test-src]: https://github.com/unplugin/unplugin-jsx-string/actions/workflows/unit-test.yml/badge.svg\n[unit-test-href]: https://github.com/unplugin/unplugin-jsx-string/actions/workflows/unit-test.yml\n","funding_links":["https://github.com/sponsors/sxzz"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funplugin%2Funplugin-jsx-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funplugin%2Funplugin-jsx-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funplugin%2Funplugin-jsx-string/lists"}