{"id":19573243,"url":"https://github.com/yrtimid/gulp-require-html-inline","last_synced_at":"2025-10-03T19:33:01.445Z","repository":{"id":47885995,"uuid":"248009311","full_name":"yrtimiD/gulp-require-html-inline","owner":"yrtimiD","description":"Gulp plugin which inlines html templates referenced using require(\"path-to-file.html\") notation","archived":false,"fork":false,"pushed_at":"2022-12-05T13:56:52.000Z","size":249,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T15:38:07.333Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/yrtimiD.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}},"created_at":"2020-03-17T15:45:04.000Z","updated_at":"2020-04-02T20:07:37.000Z","dependencies_parsed_at":"2023-01-24T05:31:41.950Z","dependency_job_id":null,"html_url":"https://github.com/yrtimiD/gulp-require-html-inline","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yrtimiD%2Fgulp-require-html-inline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yrtimiD%2Fgulp-require-html-inline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yrtimiD%2Fgulp-require-html-inline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yrtimiD%2Fgulp-require-html-inline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yrtimiD","download_url":"https://codeload.github.com/yrtimiD/gulp-require-html-inline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240840106,"owners_count":19866168,"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":[],"created_at":"2024-11-11T06:32:52.582Z","updated_at":"2025-10-03T19:32:56.403Z","avatar_url":"https://github.com/yrtimiD.png","language":"JavaScript","readme":"# gulp-require-html-inline\nGulp plugin which inline html templates referenced using `require(\"path-to-file.html\")` notation.\n\nInternally uses [html-minifier-terser](https://www.npmjs.com/package/html-minifier-terser) to convert html files to strings.\n\n## Usage example\n```sh\nnpm install --save-dev gulp-require-html-inline\n```\n\n[html-minifier-terser](https://www.npmjs.com/package/html-minifier-terser) is a peer dependency, so make sure to install it if it's not already in your `package.json`:\n\n```sh\nnpm install --save-dev html-minifier-terser@5\n```\n\n```js\n//gulpfile.js:\nconst gulp = require(\"gulp\");\nconst htmlInline = require(\"gulp-require-html-inline\");\n\ngulp.task(\"default\", function () {\n\treturn gulp.src(\"./file.js\")\n\t\t.pipe(htmlInline())\n\t\t.pipe(gulp.dest(\"result\"));\n});\n```\n\nAssuming next files are in the working folder:\n```js\n//file.js\nvar a = require(\"./test.html\");\n```\n```html\n\u003c!--test.html--\u003e\n\u003cdiv\u003e\n\tSome \" text ' with ` special characters\n\u003c/div\u003e\n```\nOutput will be a single file:\n```js\n//result/file.js\nvar a = `\u003cdiv\u003eSome \" text ' with \\` special characters\u003c/div\u003e`;\n```\nFor more examples see [demo](https://github.com/yrtimiD/gulp-require-html-inline/tree/master/demo) folder and execute `npm run demo` locally.\n\n## Configuration\n`htmlInline` function accepts optional [minifier options](https://github.com/DanielRuf/html-minifier-terser#options-quick-reference) object.\n\nIf not provided, default configuration includes `collapseWhitespace: true`\nwhich ensures that produced html is a single line (otherwise it can break commented out `require`s).\n\n## Implementation notes\n- Require statements are detected using simple regex and no semantic code parsing is done. All kind of quotation marks are supports and both `.html` and `.htm` extensions are accepted. Some examples:\n  - `require(\"a.html\")`\n  - `require('a.html')`\n  - ``require(`a.html`)``\n  - `require(\"a.htm\")`\n- Unresolved files will be skipped, logged and `require` will be untouched.\n- Multiline html files might break commented out require statements if custom minifier options are used. See [Configuration section](#configuration)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyrtimid%2Fgulp-require-html-inline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyrtimid%2Fgulp-require-html-inline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyrtimid%2Fgulp-require-html-inline/lists"}