EJS Partials - JamesDansie/data-structures-and-algorithms GitHub Wiki

EJS Partials

Author: James Dansie

Partials in EJS can be thought of as HTML variables/templates. If you have something that repeats regularly (like a nav bar or footer) then that is a prime candidate for an EJS partial. To make an ejs file just write the html section like you normal would, and name the file FILENAME.ejs, note the .ejs extension.

To call the file within the html, save the html file with the .ejs extension. Within the body of the html file call the file with <%- include('FILENAME') %>. Note that the first <%- has an - in it.


References