1.0.1 • Published 6 years ago

@lobal/html-render v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

About

Replaces placeholders wrapped in double curly braces in HTML files.

Install

npm install @lobal/html-render

Setup

//...
import htmlRender from '@lobal/html-render';
//...

//...
app.engine('html', htmlRender);
app.set('view engine', 'html');
//...

Basic usage

index.html

<html>
    <head>
        <title>{{title}}</title>
    </head>

    <body>
        <h1>{{title}}</h1>
        <p>{{message}}</p>
    </body>
</html>

End of middleware

// ...
res.render('path/to/index.html', {title: 'Hello World', message: 'Lorem ipsum.'});
// ...

Output

<html>
    <head>
        <title>Hello World</title>
    </head>

    <body>
        <h1>Hello World</h1>
        <p>Lorem ipsum.</p>
    </body>
</html>
1.0.1

6 years ago

1.0.0

6 years ago