https://github.com/hargne/html-creator
Generate HTML with node.js
https://github.com/hargne/html-creator
generator html html-generation html-tags node nodejs
Last synced: about 1 month ago
JSON representation
Generate HTML with node.js
- Host: GitHub
- URL: https://github.com/hargne/html-creator
- Owner: Hargne
- License: mit
- Created: 2017-06-30T15:03:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-02-11T18:12:31.000Z (3 months ago)
- Last Synced: 2025-04-06T02:35:18.684Z (about 1 month ago)
- Topics: generator, html, html-generation, html-tags, node, nodejs
- Language: TypeScript
- Size: 1.02 MB
- Stars: 31
- Watchers: 1
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
โ๏ธ html-creator
Generate HTML with NodeJS
Documentation ยป
## Installation
```shell
$ npm i html-creator
```## Usage
```Javascript
const htmlCreator = require("html-creator");const html = new htmlCreator([
{
type: "head",
content: [
{
type: "title",
content: "Generated HTML",
},
{
type: "style",
content: `
#cool-text {
color: red;
}
`,
},
],
},
{
type: "body",
content: [
{
type: "div",
content: [
{
type: "div",
content: "This is a cool text ๐",
attributes: { id: "cool-text" },
},
{
type: "a",
content: "Click here",
attributes: { href: "/path-to-infinity", target: "_blank" },
},
],
},
],
},
]);
const result = html.renderHTML();
```The above code will result with the following HTML output:
```HTML
Generated HTML
#cool-text {
color: red;
}
```
Visit the **[wiki](https://github.com/Hargne/html-creator/wiki)** for more examples of usage, method reference and further reading.
# Wanna Contribute?
Do you believe that something is missing from this plugin or perhaps is not working as intended? Awesome-pants! Help is always appreciated.
Just be sure to read through the [Contributing Handbook](https://github.com/Hargne/html-creator/wiki/Contributing-Handbook) (and remember to have a jolly good time).