express-low-layout
Low-layout is a layout system based on Mustache and Express.
Instalation
$ npm install express-low-layout
Usage
const layout = app
Exemple:
install express and express-low-layout
$ npm install --save express $ npm install --save express-low-layout
index.js
Create a simple express app with two route: /home and /test
var express = var layout = var app = //set the views directoryappapp //home routeapp //test routeapp app app
/views/page/default.html
The template for the page For the template syntax read the mustache js documentation
<!-- block head --> {{{blocks.head}}} Home Test <!-- block content --> {{{blocks.content}}} footer
/views/page/head.html
template for the head block define in the file views/page/default.html
{{title}} {{#css}} {{/css}} {{#js}} {{/js}}
/views/home.html
The template for the /home route
Home page
/views/test.html
The template for the /test route
Test
Run:
$ node index.js