{"id":20284196,"url":"https://github.com/clebert/esbuild-html-plugin","last_synced_at":"2025-09-09T05:37:04.439Z","repository":{"id":171087046,"uuid":"647427447","full_name":"clebert/esbuild-html-plugin","owner":"clebert","description":"An esbuild plugin that generates an HTML file.","archived":false,"fork":false,"pushed_at":"2024-07-16T15:45:00.000Z","size":222,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-01T21:43:13.681Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clebert.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}},"created_at":"2023-05-30T19:01:48.000Z","updated_at":"2025-08-07T21:43:06.000Z","dependencies_parsed_at":"2024-05-15T14:46:52.199Z","dependency_job_id":"5557bc87-efb9-432c-906a-abf6f46a684c","html_url":"https://github.com/clebert/esbuild-html-plugin","commit_stats":null,"previous_names":["clebert/esbuild-html-plugin"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/clebert/esbuild-html-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clebert%2Fesbuild-html-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clebert%2Fesbuild-html-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clebert%2Fesbuild-html-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clebert%2Fesbuild-html-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clebert","download_url":"https://codeload.github.com/clebert/esbuild-html-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clebert%2Fesbuild-html-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274249834,"owners_count":25249391,"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-09-09T02:00:10.223Z","response_time":80,"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-11-14T14:18:41.235Z","updated_at":"2025-09-09T05:37:04.408Z","avatar_url":"https://github.com/clebert.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esbuild-html-plugin\n\n\u003e An esbuild plugin that generates an HTML file.\n\nThis esbuild plugin allows the creation of an HTML file featuring output URLs of bundled assets,\nwhile supporting customization of head and body elements.\n\n## Installation\n\n```\nnpm install esbuild-html-plugin\n```\n\n## Usage Example\n\n```js\nimport * as esbuild from 'esbuild';\n\nawait esbuild.build({\n  entryPoints: [`app.ts`],\n  bundle: true,\n  outdir: `dist`,\n  publicPath: `/static`,\n  plugins: [\n    htmlPlugin({\n      outfile: `index.html`,\n\n      createHeadElements: () =\u003e [\n        `\u003cmeta charset=\"utf-8\" /\u003e`,\n        `\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /\u003e`,\n        `\u003ctitle\u003eExample\u003c/title\u003e`,\n      ],\n\n      createBodyElements: (outputUrls) =\u003e\n        outputUrls\n          .filter((outputUrl) =\u003e outputUrl.endsWith(`.js`))\n          .map((outputUrl) =\u003e `\u003cscript src=\"${outputUrl}\"\u003e\u003c/script\u003e`),\n    }),\n  ],\n});\n```\n\n## Options\n\n### `outfile` (required)\n\nThe output file's name for the generated HTML. This name will be combined with the `outdir` or the\ndirname of the `outfile` from the esbuild options.\n\n```\n{\n  outfile: `index.html`,\n}\n```\n\n### `language` (optional)\n\nThe language attribute for the HTML tag.\n\n```\n{\n  language: `en`,\n}\n```\n\n### `createHeadElements` (optional)\n\nA function that receives the output URLs of the bundled assets and returns an array of strings\nrepresenting the custom head elements.\n\n```\n{\n  createHeadElements: (outputUrls) =\u003e\n    outputUrls\n      .filter((outputUrl) =\u003e outputUrl.endsWith(`.css`))\n      .map((outputUrl) =\u003e `\u003clink rel=\"stylesheet\" href=\"${outputUrl}\"\u003e`),\n}\n```\n\n### `createBodyElements` (optional)\n\nA function that receives the output URLs of the bundled assets and returns an array of strings\nrepresenting the custom body elements.\n\n```\n{\n  createBodyElements: (outputUrls) =\u003e\n    outputUrls\n      .filter((outputUrl) =\u003e outputUrl.endsWith(`.js`))\n      .map((outputUrl) =\u003e `\u003cscript src=\"${outputUrl}\"\u003e\u003c/script\u003e`),\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclebert%2Fesbuild-html-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclebert%2Fesbuild-html-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclebert%2Fesbuild-html-plugin/lists"}