Restructuring the views folder using partials
Now we will make a major change to the structure of directories in the views
folder: we will add an important Embedded JavaScript (EJS) resource for the creation of reusable files in our templates.
They are known as partial files and will be included in our application using the <% = include %>
tag.
Tip
You can find more information about EJS on the official project page at: http://ejs.co/
Inside the views
folder, we will create two more folders, called partials
and pages
:
- The
pages
folder will be as follows at this point: - Now let's move the files that were in the
views
folder to thepages
folder. - Create a
pages
folder inside theviews
folder. - Create a
partials
folder inside theviews
folder.server/
pages/ ...
Get Node.js 6.x Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.