{"id":15016562,"url":"https://github.com/gregives/eleventy-load-html","last_synced_at":"2026-01-05T07:10:11.654Z","repository":{"id":48441788,"uuid":"291151518","full_name":"gregives/eleventy-load-html","owner":"gregives","description":"Find dependencies in and minify HTML using eleventy-load","archived":false,"fork":false,"pushed_at":"2021-07-26T09:20:56.000Z","size":181,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T05:51:57.222Z","etag":null,"topics":["eleventy","eleventy-load","html"],"latest_commit_sha":null,"homepage":"","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/gregives.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-28T21:43:43.000Z","updated_at":"2021-07-26T09:21:00.000Z","dependencies_parsed_at":"2022-09-11T09:22:18.724Z","dependency_job_id":null,"html_url":"https://github.com/gregives/eleventy-load-html","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-load-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-load-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-load-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-load-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregives","download_url":"https://codeload.github.com/gregives/eleventy-load-html/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244990069,"owners_count":20543614,"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":["eleventy","eleventy-load","html"],"created_at":"2024-09-24T19:49:04.886Z","updated_at":"2026-01-05T07:10:06.616Z","avatar_url":"https://github.com/gregives.png","language":"JavaScript","readme":"# eleventy-load-html\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n[![Prettier][prettier-src]][prettier-href]\n\nFind dependencies in and minify HTML using [eleventy-load](https://github.com/gregives/eleventy-load).\n\n## Getting Started\n\nFirstly, you'll need to install [eleventy-load](https://github.com/gregives/eleventy-load) (if you haven't already) and eleventy-load-html.\n\n```sh\nnpm install --save-dev eleventy-load eleventy-load-html\n```\n\nThen you can set up eleventy-load-html using a rule in your eleventy-load options. Note that eleventy-load tests the **input path**, so we want to apply eleventy-load-html to both HTML and Markdown templates. Within a template the dependency source path should be relative to the input path: \n\ne.g. for dependency `\u003cinputPath\u003e/sass/styles.scss` use `\u003clink rel=\"stylesheet\" href=\"sass/styles.scss\" /\u003e`\n\n```js\nmodule.exports = function (eleventyConfig) {\n  eleventyConfig.addPlugin(require(\"eleventy-load\"), {\n    rules: [\n      {\n        test: /\\.(html|md)$/,\n        loaders: [\n          {\n            loader: require(\"eleventy-load-html\"),\n          },\n        ],\n      },\n    ],\n  });\n};\n```\n\n## Options\n\n| Name                            | Type              | Default | Description                                                                           |\n| ------------------------------- | ----------------- | ------- | ------------------------------------------------------------------------------------- |\n| [**`attributes`**](#attributes) | `Boolean`         | `true`  | Find dependencies from HTML attributes                                                |\n| [**`minimize`**](#minimize)     | `Boolean\\|Object` | `false` | Minimize using [html-minifier-terser](https://github.com/terser/html-minifier-terser) |\n\n### `attributes`\n\nType: `Boolean` Default: `true`\n\nFind dependencies from HTML attributes which will be processed by eleventy-load (if a loader is configured to process the dependency).\n\n\u003cdetails\u003e\n\u003csummary\u003eList of attributes which eleventy-load-html checks for dependencies\u003c/summary\u003e\n\n```js\nconst ATTRIBUTES = [\n  {\n    tag: \"audio\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"embed\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"img\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"img\",\n    attribute: \"srcset\",\n  },\n  {\n    tag: \"input\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"link\",\n    attribute: \"href\",\n  },\n  {\n    tag: \"object\",\n    attribute: \"data\",\n  },\n  {\n    tag: \"script\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"script\",\n    attribute: \"href\",\n  },\n  {\n    tag: \"script\",\n    attribute: \"xlink:href\",\n  },\n  {\n    tag: \"source\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"source\",\n    attribute: \"srcset\",\n  },\n  {\n    tag: \"track\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"video\",\n    attribute: \"poster\",\n  },\n  {\n    tag: \"video\",\n    attribute: \"src\",\n  },\n  {\n    tag: \"image\",\n    attribute: \"xlink:href\",\n  },\n  {\n    tag: \"image\",\n    attribute: \"href\",\n  },\n  {\n    tag: \"use\",\n    attribute: \"xlink:href\",\n  },\n  {\n    tag: \"use\",\n    attribute: \"href\",\n  },\n];\n```\n\n\u003c/details\u003e\n\n### `minimize`\n\nType: `Boolean|Object` Default: `false`\n\nIf `true` or an `Object`, eleventy-load-html will minimize HTML using [html-minifier-terser](https://github.com/terser/html-minifier-terser). If an `Object`, these will be provided to html-minifier-terser as options.\n\n```js\n{\n  loader: require(\"eleventy-load-html\"),\n  options: {\n    minimize: {\n      removeComments: true,\n    }\n  },\n},\n```\n\n\u003c!-- References --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/eleventy-load-html/latest.svg\n[npm-version-href]: https://npmjs.com/package/eleventy-load-html\n[npm-downloads-src]: https://img.shields.io/npm/dt/eleventy-load-html.svg\n[npm-downloads-href]: https://npmjs.com/package/eleventy-load-html\n[license-src]: https://img.shields.io/npm/l/eleventy-load-html.svg\n[license-href]: https://npmjs.com/package/eleventy-load-html\n[prettier-src]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg\n[prettier-href]: https://github.com/prettier/prettier\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregives%2Feleventy-load-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregives%2Feleventy-load-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregives%2Feleventy-load-html/lists"}