1.0.2 • Published 4 years ago

open-html-parser v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

OpenHTML ALPHA

OpenHTML is a html parser made to be lightweight and easy to use.

Installation

$ npm i open-html-parser

Setup

Javascript

const OpenHTML = require('open-html-parser');
const app = new OpenHTML.App(<path to openhtml file>, <port>);

Typescript

import { App } from 'open-html-parser';
const app = new App(<path to openhtml file>, <port>);

Using custom elements

To use a custom element you just have to use app.use

app.use(<name of element>, <path to openhtml or html file>);

The layout of the file should be:

<html>
</html>

Add data if you are using a .ohtml file.
<data>
</data>

To use the element in your main file just use:

<name of element></name of element>

Making OpenHTML files

Create a new file with the extension .ohtml. The layout of the file should be:

<html>
</html>

<data>
</data>

The html tag functions exactly like a normal html file would except you can use variables from the data tag using %data%.

<html>
<head>
</head>
<body>
	<p>%string%</p>
	<p>%number%</p>
</body>
</html>

<data>
string="test";
number=1234;
array=[1,2,3,4];
object={"test":"test"};
</data>
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago