0.7.2 โ€ข Published 5 months ago

html-creator v0.7.2

Weekly downloads
397
License
MIT
Repository
github
Last release
5 months ago

Installation

$ npm i html-creator

Usage

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:

<!DOCTYPE html>
<html>
  <head>
    <title>Generated HTML</title>
    <style>
      #cool-text {
        color: red;
      }
    </style>
  </head>
  <body>
    <div>
      <div id="cool-text">This is a cool text ๐Ÿ˜Ž</div>
      <a href="/path-to-infinity" target="_blank">Click here</a>
    </div>
  </body>
</html>

Visit the 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 (and remember to have a jolly good time).

0.7.2

5 months ago

0.8.0

7 months ago

0.7.1

10 months ago

0.7.0

1 year ago

0.6.3

1 year ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

3 years ago

0.4.4

4 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago