1.2.2 • Published 7 months ago

html-reusable v1.2.2

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

html-reusable

npm version GitHub issues GitHub license

A simple library to create reusable components in HTML.

Installation

Install the library using npm:

npm install html-reusable

Make sure to install the required dependencies as well:

npm install node-html-transformers puppeteer

Usage

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

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.
1.2.0

7 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.1.0

2 years ago

1.0.0

2 years ago