{"id":15043178,"url":"https://github.com/berardo/html-es6-template-loader","last_synced_at":"2025-04-14T21:13:02.812Z","repository":{"id":57267390,"uuid":"81461841","full_name":"berardo/html-es6-template-loader","owner":"berardo","description":"Webpack loader to parse HTML as ES6 template strings","archived":false,"fork":false,"pushed_at":"2018-06-02T05:08:39.000Z","size":6,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T21:12:57.606Z","etag":null,"topics":["es6-javascript","javascript","loader","webpack","webpack-loader","webpack2"],"latest_commit_sha":null,"homepage":null,"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/berardo.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}},"created_at":"2017-02-09T15:02:57.000Z","updated_at":"2020-10-05T21:29:02.000Z","dependencies_parsed_at":"2022-09-02T05:40:51.476Z","dependency_job_id":null,"html_url":"https://github.com/berardo/html-es6-template-loader","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berardo%2Fhtml-es6-template-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berardo%2Fhtml-es6-template-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berardo%2Fhtml-es6-template-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berardo%2Fhtml-es6-template-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berardo","download_url":"https://codeload.github.com/berardo/html-es6-template-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961237,"owners_count":21189993,"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":["es6-javascript","javascript","loader","webpack","webpack-loader","webpack2"],"created_at":"2024-09-24T20:48:40.148Z","updated_at":"2025-04-14T21:13:02.789Z","avatar_url":"https://github.com/berardo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/html-es6-template-loader.svg)](https://badge.fury.io/js/html-es6-template-loader)\n![Dependencies status](https://david-dm.org/berardo/html-es6-template-loader/status.svg)\n![devDependencies status](https://david-dm.org/berardo/html-es6-template-loader/dev-status.svg)\n\n# WEBPACK - HTML ES6 TEMPLATE LOADER\n\nWebpack loader to parse HTML as ES6 template strings\n\n## Motivation\n\nThis loader is mostly indicated for vanilla Javascript projects\n(no template engines), as it surrounds imported html file with\nES6 string templates operator (backticks: ``) and gives you\nability to load exported HTML / text files as local strings,\nsuporting interpolations.\n\n## Usage\n\nTo add it as dev dependency:\n```bash\nnpm install --save-dev html-es6-template-loader\n```\n\nTo set this loader on **webpack.config.js**:\n```javascript\nmodule: {\n  rules: [\n    {\n      test: /\\.html$/,\n      use: ['html-es6-template-loader']\n    },\n  ],\n}\n```\n\nA template may look like this:\nFile: e.g. `template.html`\n```html\n\u003cdiv\u003eEvery time you use ${this.avoid} a ${this.who} dies\u003c/div\u003e\n```\n\nA javascript file may look like this:\n ```javascript\n import template from './template.html';\n\n document.getElementById('container').innerHTML = template({\n   avoid: 'var',\n   who: 'puppy'\n });\n ```\n\nYou might want to have the template exported as ES5 concatenated string.\nTo do that, just add a query parameter `transpile = true`:\n\n```javascript\nmodule: {\n  rules: [\n    {\n      test: /\\.html$/,\n      use: ['html-es6-template-loader'],\n      options: {\n        transpile: true\n      },\n    },\n  ],\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberardo%2Fhtml-es6-template-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberardo%2Fhtml-es6-template-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberardo%2Fhtml-es6-template-loader/lists"}