{"id":13827675,"url":"https://github.com/trentmwillis/html-template-es-modules","last_synced_at":"2025-04-23T13:44:56.154Z","repository":{"id":65996694,"uuid":"126362439","full_name":"trentmwillis/html-template-es-modules","owner":"trentmwillis","description":"A simple proof-of-concept for importing HTML Templates into ES Modules","archived":false,"fork":false,"pushed_at":"2018-05-23T16:48:54.000Z","size":21,"stargazers_count":43,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T00:12:03.648Z","etag":null,"topics":["es-modules","esmodules","html-templates","service-workers"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trentmwillis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-22T16:14:24.000Z","updated_at":"2024-12-07T13:21:59.000Z","dependencies_parsed_at":"2023-07-06T09:01:21.029Z","dependency_job_id":null,"html_url":"https://github.com/trentmwillis/html-template-es-modules","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentmwillis%2Fhtml-template-es-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentmwillis%2Fhtml-template-es-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentmwillis%2Fhtml-template-es-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trentmwillis%2Fhtml-template-es-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trentmwillis","download_url":"https://codeload.github.com/trentmwillis/html-template-es-modules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250441902,"owners_count":21431234,"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":["es-modules","esmodules","html-templates","service-workers"],"created_at":"2024-08-04T09:02:05.124Z","updated_at":"2025-04-23T13:44:56.135Z","avatar_url":"https://github.com/trentmwillis.png","language":"JavaScript","readme":"# HTML Template ES Modules\n\nA simple, proof-of-concept for importing HTML files as HTML Templates into ES Modules. Made possible by using [`Service Workers`](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) to transparently transform HTML file responses into ES Modules that export an [`HTMLTemplateElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement).\n\n## Example\n\nGiven [`hello-world.html`](./hello-world.html):\n\n```html\n\u003ch1\u003eHello, world!\u003c/h1\u003e\n\u003cp\u003e\u003cem\u003eComing at you live, from an HTML Template imported as an ES Module!\u003c/em\u003e\u003c/p\u003e\n```\n\nYou can import it in [`hello-world.js`](./hello-world.js) like so:\n\n```js\nimport template from './hello-world.html';\nconsole.log(template.toString()); // [object HTMLTemplateElement]\n```\n\nFrom there you can clone the template and insert it into the DOM! Or do whatever else you'd like with the element.\n\n## Running The Demo\n\nTo try out the demo, do the following:\n\n* Clone the repo: `git clone https://github.com/trentmwillis/html-template-es-modules.git`\n* Install dependencies in the repo: `cd html-template-es-modules \u0026\u0026 npm install`\n* Run the server: `npm run start`\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrentmwillis%2Fhtml-template-es-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrentmwillis%2Fhtml-template-es-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrentmwillis%2Fhtml-template-es-modules/lists"}