everydev / iga-express-render

render engine for Express with nested partial html and local complex data binding

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Render engine for Express using partial Html files

I was searching a simple render engine for Express that support nested object and nested partial html.
I was pissed off to not find what I wanted.
I just created a new one, enough fast to write a new one.
Container page, called sometime Layout, is a WebPage class. It contains partial pages, called Component.
WebPage class inherits from Component.
Each Component can contains several other Components.
A Component reference a Component by its name like this:
'#Component.topMenu#'
local object binding is done by declaring the property of the localData object:
'#title#' or
'#user.name#'

##Sample:

Create a page object

new WebPage("home", "home.html",
{ "og:site_name": "Fratelo", "og:type": "website" },
{
    title: "Fratelo is your toolbox for freelancing",
    updated: "2019-07-15", token: "afeab-231e"
},
[
    new Component("topMenu", "_topMenu.html"),
    new Component("login", "_login.html", { username: "Pascal Martin" }),
    new Component("bodyContent", "_homeBodyContent.html")
])

About

render engine for Express with nested partial html and local complex data binding

License:GNU General Public License v3.0


Languages

Language:JavaScript 95.2%Language:HTML 4.8%