-
Book Overview & Buying
-
Table Of Contents
Mastering Web Application Development with Express
By :
Partial views (more commonly known as partials) allow us to define commonly shared parts of a web page (for example, the header and the footer) that can be reused in multiple views.
Partials have been removed from Express since Version 3, and they are now template-specific, meaning it's the decision of the template engine to provide them or not.
Let's consider a sample application that has multiple pages but each one shares the header and the footer. For starters, we are going to create this application using EJS and then achieve the same with Jade.
The server-ejs.js file will initialize everything and render index.html as the main page of the application, as shown in the following code:
var express = require('express');
var ejs = require('ejs');
var app = express();
// assign the ejs engine to .html files
app.engine('html', ejs.renderFile);
// set .html as the default extension
app.set('view engine...
Change the font size
Change margin width
Change background colour