{"id":21541518,"url":"https://github.com/reshape/custom-elements","last_synced_at":"2025-06-27T10:06:54.783Z","repository":{"id":10313151,"uuid":"65310965","full_name":"reshape/custom-elements","owner":"reshape","description":"plugin that parses custom element names into classes","archived":false,"fork":false,"pushed_at":"2022-02-11T21:36:52.000Z","size":562,"stargazers_count":5,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-16T00:48:11.937Z","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/reshape.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-09T16:31:41.000Z","updated_at":"2023-12-24T09:13:47.000Z","dependencies_parsed_at":"2022-08-07T05:15:41.231Z","dependency_job_id":null,"html_url":"https://github.com/reshape/custom-elements","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/reshape/custom-elements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reshape%2Fcustom-elements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reshape%2Fcustom-elements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reshape%2Fcustom-elements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reshape%2Fcustom-elements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reshape","download_url":"https://codeload.github.com/reshape/custom-elements/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reshape%2Fcustom-elements/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260595653,"owners_count":23033787,"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-24T05:04:57.398Z","updated_at":"2025-06-27T10:06:54.757Z","avatar_url":"https://github.com/reshape.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reshape Custom Elements\n\n[![npm](https://img.shields.io/npm/v/reshape-custom-elements.svg?style=flat-square)](https://npmjs.com/package/reshape-custom-elements)\n[![tests](https://img.shields.io/travis/reshape/custom-elements.svg?style=flat-square)](https://travis-ci.org/reshape/custom-elements?branch=master)\n[![dependencies](https://img.shields.io/david/reshape/custom-elements.svg?style=flat-square)](https://david-dm.org/reshape/custom-elements)\n[![coverage](https://img.shields.io/coveralls/reshape/custom-elements.svg?style=flat-square)](https://coveralls.io/r/reshape/custom-elements?branch=master)\n\nTransform custom element names into class names.\n\n## Installation\n\n```sh\nnpm i reshape-custom-elements --save\n```\n\n## Usage\n\n### Input HTML\n\n```html\n\u003cmy-component\u003e\n  \u003cmy-text class=\"text\"\u003eText\u003c/my-text\u003e\n\n  \u003c!-- An actual HTML element defined in additionalTags --\u003e\n  \u003clabel\u003eLabel\u003c/label\u003e\n\n  \u003c!-- Overriding the default replacement tag with a map --\u003e\n  \u003cmy-footer\u003e\n    Reshape is licensed under the MIT license\n  \u003c/my-footer\u003e\n\n  \u003c!-- Locally overriding the default replacement tag with an attribute --\u003e\n  \u003cmy-text data-replacement=\"div\"\u003e\n    This will get wrapped in a div instead of a span\n  \u003c/my-text\u003e\n\u003c/my-component\u003e\n```\n\n### Reshape processing\n\n```js\nconst reshape = require('reshape')\nconst customElements = require('reshape-custom-elements')\n\nreshape({\n  plugins: [\n    customElements({\n      replacementTag: 'span',\n      additionalTags: ['label'],\n      replacementTagMap: {\n        footer: ['my-footer']\n      }\n    })\n  ]\n})\n  .process(html)\n  .then(res =\u003e console.log(res.output()))\n```\n\n### Output HTML\n\n```html\n\u003cspan class=\"my-component\"\u003e\n  \u003cspan class=\"my-text text\"\u003eText\u003c/span\u003e\n\n  \u003cspan class=\"label\"\u003eLabel\u003c/span\u003e\n\n  \u003cdiv class=\"my-text\"\u003e\n    This will get wrapped in a div instead of a span\n  \u003c/div\u003e\n\n  \u003cfooter class=\"my-footer\"\u003e\n    Reshape is licensed under the MIT license\n  \u003c/footer\u003e\n\u003c/span\u003e\n```\n\n## Options\n\n| Name                                | Description                                                                                                                                                | Default            |\n| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |\n| **defaultReplacementTag**           | Tag used to replace the custom element tag name                                                                                                            | `div`              |\n| **additionalTags**                  | Array of tags to be processed despite being a normal HTML tag. HTML tags that are used in the `replacementTagMap` will automatically be added to this list | `[]`               |\n| **blacklist**                       | Array of tags that should never be processed                                                                                                               | `[]`               |\n| **replacementTagMap**               | Object containing custom tag ↔ replacement tag mappings in the format: `ReplacedTag: [ customTag1, customTag2, ... ]`. Overrides `replacementTag`          | `{}`               |\n| **replacementTagOverrideAttribute** | Attribute name that can be used to locally override the used replacement tag. Overrides `replacementTag` and `replacementTagMap`                           | `data-replacement` |\n\n## License\n\n- Licensed under [MIT](LICENCE.md)\n- See our [contributing guidelines](contributing.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freshape%2Fcustom-elements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freshape%2Fcustom-elements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freshape%2Fcustom-elements/lists"}