{"id":25238068,"url":"https://github.com/dmccrthy/webpack-custom-elements","last_synced_at":"2026-02-16T20:12:28.252Z","repository":{"id":271817183,"uuid":"912661910","full_name":"dmccrthy/webpack-custom-elements","owner":"dmccrthy","description":"Create HTML custom elements dynamically with Webpack","archived":false,"fork":false,"pushed_at":"2025-04-15T04:22:25.000Z","size":50,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T19:02:14.924Z","etag":null,"topics":["html","javascript","webpack"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/webpack-custom-elements","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/dmccrthy.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}},"created_at":"2025-01-06T06:12:39.000Z","updated_at":"2025-01-11T22:23:57.000Z","dependencies_parsed_at":"2025-01-10T04:35:31.618Z","dependency_job_id":null,"html_url":"https://github.com/dmccrthy/webpack-custom-elements","commit_stats":null,"previous_names":["dmccrthy/webpack-custom-elements"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dmccrthy/webpack-custom-elements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccrthy%2Fwebpack-custom-elements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccrthy%2Fwebpack-custom-elements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccrthy%2Fwebpack-custom-elements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccrthy%2Fwebpack-custom-elements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmccrthy","download_url":"https://codeload.github.com/dmccrthy/webpack-custom-elements/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccrthy%2Fwebpack-custom-elements/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270856775,"owners_count":24657700,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["html","javascript","webpack"],"created_at":"2025-02-11T16:43:28.447Z","updated_at":"2026-02-16T20:12:26.175Z","avatar_url":"https://github.com/dmccrthy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack Custom Elements\n\nDynamically add \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements\"\u003e custom elements\u003c/a\u003e to you Javascript using webpack.\n\n## 🗒️ License\nThis package is provided under the MIT license, for more information see LICENSE.\n\n## 🏁 Getting Started\n\n1. **Install Package**\n    \n    In your webpack project run the following command to install the package.\n\n    ```shell\n    npm install webpack-custom-elements\n    ```\n\n2. **Setup Webpack Config**\n\n    In your webpack config you will want to add a new rule in as shown below\n\n    ```js\n    module: {\n        rules: [\n            {\n                test: /\\main.js$/,\n                use: [\n                    {\n                        loader: \"webpack-custom-elements\",\n                        options: {\n                            source: \"./src/components\",\n                            keepElements: false,\n                        },\n                    },\n                ],\n            },\n\n            // ...other rules\n        ],\n    },\n    ```\n\n    - **test:** \n        - The name of your **target javascript file** (ie: the one being imported into your HTML)\n    - **source:** \n        - The **RELATIVE Path** to your components folder\n    - **keepElements (Optional):** \n        - Determines if custom elements are preserved in HTML\n        - Set to **true** or **false** (defaults to **false**)\n\n3. **Create Custom Elements**\n\n    In your specified source folder add an .html file which will contain you element. **Component files MUST be named in all lowercase with dashes.** This is required for \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements\"\u003eHTML custom elements\u003c/a\u003e, you will get an error if you don't. \n    \n    ```html\n    \u003cnav\u003e\n        \u003ca\u003eHome\u003c/a\u003e\n        \u003ca\u003eAbout\u003c/a\u003e\n        \u003ca\u003eContact\u003c/a\u003e\n    \u003c/nav\u003e\n    ```\n    \n    Outside of that no special templating is needed; processing the HTML will be handled by the loader so its fine. To use your elements simply reference them by there name in your HTML. **Depending on the value of keepElements, the custom elements may be compiled out.**\n\n    ```html\n    \u003cbody\u003e\n        \u003cnav-bar\u003e\n\n        // ...other elements\n    \u003c/body\u003e\n    ```\n\n##\n\nThis project is a work in-progress and is likely to change overtime. If you find any bugs, or have feature requests feel free to fill out an issue.\n\n-Dan\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmccrthy%2Fwebpack-custom-elements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmccrthy%2Fwebpack-custom-elements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmccrthy%2Fwebpack-custom-elements/lists"}