January 2018
Beginner
658 pages
13h 10m
English
A partial is a partial piece of your website. It's something you can reuse throughout your templates. For example, we might have a footer partial that renders the footer code. You can include that partial on any page you need a footer. You could do the same thing for header. In order to get started, the first thing we need to do is set up our server.js file just a little bit to let handlebars know that we want to add support for partials.
In order to do this, we'll add one line of code in the server.js file where we declared our view engine previously, and it will look something like this (hbs.registerPartials):
hbs.registerPartialsapp.set('view engine', 'hbs');app.use(express.static(__dirname + '/public'));
Now registerPartials ...
Read now
Unlock full access