# html-reusable

> A simple library to create reusable components in html

Latest version **1.2.2** (published 2024-02-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install html-reusable
pnpm add html-reusable
yarn add html-reusable
bun add html-reusable
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2024-02-09 |
| First published | 2023-01-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Ayomikun Faluyi |
| Maintainers | dcoder-x |
| Keywords | html, reusable components |

## Links

- npm: https://www.npmjs.com/package/html-reusable
- Repository: https://github.com/dcoder-x/htmlReusable
- Homepage: https://github.com/dcoder-x/htmlReusable#readme
- Issues: https://github.com/dcoder-x/htmlReusable/issues
- npm.io page: https://npm.io/package/html-reusable

## Dependencies (2)

- [puppeteer](https://npm.io/package/puppeteer.md) ^22.0.0
- [node-html-transformers](https://npm.io/package/node-html-transformers.md) ^1.0.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2024-02-09
- 1.2.1 — 2024-02-09
- 1.2.0 — 2024-02-09
- 1.1.0 — 2023-01-25
- 1.0.0 — 2023-01-25

## README

# html-reusable

[![npm version](https://badge.fury.io/js/html-reusable.svg)](https://www.npmjs.com/package/html-reusable)
[![GitHub issues](https://img.shields.io/github/issues/dcoder-x/htmlReusable)](https://github.com/dcoder-x/htmlReusable/issues)
[![GitHub license](https://img.shields.io/github/license/dcoder-x/htmlReusable)](https://github.com/dcoder-x/htmlReusable/blob/main/LICENSE)

A simple library to create reusable components in HTML.

## Installation

Install the library using npm:

```bash
npm install html-reusable
```
Make sure to install the required dependencies as well:

```bash
npm install node-html-transformers puppeteer
```

## Usage

```javascript
const reuse = require('html-reusable');

// Example usage
const MyComponent = reuse('my-component', {
    htmlFilePath: 'path/to/my-component.html',
    encoding: 'utf-8',
    content: 'Hello, this is my component!',
    // Optional parameters: isShadow, isBody
});
```

## API
```javascript
reuse(componentName, options, isShadow, isBody)
```

Create and register a reusable web component.

- componentName: String, the name for the custom element.
- options: Object, containing HTML file details {htmlFilePath, encoding, content}.
- htmlFilePath: String, the path to the HTML file.
- encoding: String, the encoding of the HTML file.
- content: String, the content of the HTML file.
- isShadow (optional): Boolean, indicates whether to use shadow DOM (default: false).
- isBody (optional): Boolean, indicates whether to append to the document body (default: true).
- Returns the created reusable class.

## License
- This project is licensed under the ISC License.

## Contributing
- Feel free to open issues or submit pull requests for improvements.

## Bugs/Issues
- If you encounter any issues or have suggestions, please create an issue.

## Author
- Ayomikun Faluyi

## Changelog
- See the CHANGELOG.md file for details.

## Acknowledgments
- Special thanks to contributors and open-source projects used in this library.

---
_Source: https://npm.io/package/html-reusable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
