{"id":28723310,"url":"https://github.com/hmpl-language/vite-plugin-hmpl","last_synced_at":"2026-03-01T01:02:39.977Z","repository":{"id":292642193,"uuid":"980242801","full_name":"hmpl-language/vite-plugin-hmpl","owner":"hmpl-language","description":"Plugin for files with .hmpl extension for Vite","archived":false,"fork":false,"pushed_at":"2025-11-15T22:07:04.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T16:34:44.154Z","etag":null,"topics":["hmpl","hmpl-js","vite","vite-plugin","vite-plugin-hmpl","vitejs"],"latest_commit_sha":null,"homepage":"https://hmpl-lang.dev/vite-plugin","language":"JavaScript","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/hmpl-language.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}},"created_at":"2025-05-08T20:03:33.000Z","updated_at":"2025-11-15T21:58:48.000Z","dependencies_parsed_at":"2025-05-11T10:19:40.270Z","dependency_job_id":"e0f8022f-9f99-49da-a87b-e8b4f570db31","html_url":"https://github.com/hmpl-language/vite-plugin-hmpl","commit_stats":null,"previous_names":["hmpl-language/vite-plugin-hmpl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hmpl-language/vite-plugin-hmpl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmpl-language%2Fvite-plugin-hmpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmpl-language%2Fvite-plugin-hmpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmpl-language%2Fvite-plugin-hmpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmpl-language%2Fvite-plugin-hmpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hmpl-language","download_url":"https://codeload.github.com/hmpl-language/vite-plugin-hmpl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hmpl-language%2Fvite-plugin-hmpl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29957128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["hmpl","hmpl-js","vite","vite-plugin","vite-plugin-hmpl","vitejs"],"created_at":"2025-06-15T09:13:19.919Z","updated_at":"2026-03-01T01:02:39.882Z","avatar_url":"https://github.com/hmpl-language.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-hmpl\n\n[![npm-version](https://img.shields.io/npm/v/vite-plugin-hmpl?logo=npm\u0026color=fff)](https://www.npmjs.com/package/vite-plugin-hmpl)\n\nThis Vite plugin is designed for compiling files with the `.hmpl` extension using the [hmpl-js](https://www.npmjs.com/package/hmpl-js) package. It allows you to use HMPL templates directly in your Vite-powered projects.\n\n\u003e The plugin works with `hmpl-js` version 1.0.4 or higher.\n\n## Installation\n\n```bash\nnpm install --save-dev vite-plugin-hmpl\n```\n\n## Usage\n\nIn your `vite.config.js` file, add the following configuration:\n\n```javascript\nimport { defineConfig } from \"vite\";\nimport hmplPlugin from \"vite-plugin-hmpl\";\n\nexport default defineConfig({\n  plugins: [\n    hmplPlugin({\n      memo: true,\n      sanitize: true,\n    }),\n  ],\n});\n```\n\n### Example\n\nWith this plugin, you can import `.hmpl` files as templates in your JavaScript code.\n\n#### template.hmpl\n\n```html\n\u003cdiv\u003e{{#request src=\"/api/test\"}} {{/request}}\u003c/div\u003e\n```\n\n#### main.js\n\n```javascript\nimport templateFn from \"./template.hmpl\";\n\nconst elementObj = templateFn();\n```\n\n## Plugin Options\n\nThe plugin supports various configuration options. Here are the most commonly used ones:\n\n```javascript\nhmplPlugin({\n  memo: true,\n  sanitize: true,\n  autoBody: { formData: true },\n  allowedContentTypes: [\"text/html\"],\n  disallowedTags: [\"script\", \"style\"],\n  include: [\"src/templates/**/*.hmpl\"], // Glob pattern to include specific files\n  exclude: [\"**/*.test.hmpl\"], // Glob pattern to exclude specific files\n});\n```\n\n### Option Descriptions:\n\n- **include**: (string or array of strings) Glob pattern to specify which files to include. Defaults to `**/*.hmpl`.\n- **exclude**: (string or array of strings) Glob pattern to specify which files to exclude. Defaults to `**/node_modules/**`.\n\nThe full list of options is described in the [HMPL language specification](https://spec.hmpl-lang.dev/#options).\n\n## Changelog\n\nYou can view the changelog for this plugin on the [GitHub releases page](https://github.com/hmpl-language/vite-plugin-hmpl/releases).\n\n## Contributors\n\nThis project was created in collaboration with [Saptarshi Mula](https://github.com/toyaAoi). Many thanks to him!\n\n## License\n\nThis project is licensed under the [MIT License](https://github.com/hmpl-language/vite-plugin-hmpl/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmpl-language%2Fvite-plugin-hmpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhmpl-language%2Fvite-plugin-hmpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmpl-language%2Fvite-plugin-hmpl/lists"}