Discover FortressJS - A fast, secure and easy I/O framework

Adrien-fr
70.9K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Previous: Pages in FortressJS

Templates

You can manage your templates with pages as you want. For example, you can introduce your own custom variables like __MY_VAR and manage them in your page controller.

For example, find a way to get this work :

Get the page redirected
Help

Select the right view, and change the template var

Using Pug, a template engine

Pug is a NodeJS template engine. You can discover it here (Pug)[https://pugjs.org/api/getting-started.html].

It's easy to integrate with FortressJS :

npm install pug

Once done, use var pug = require("pug"); to use it.

Try it with this exercise :

  • Update home.page.js
  • Go to the fortressjs folder
  • Install pug
  • Launch FortressJS
Install Jade and use it
Help

install pug with npm in fortressjs folder, and do a "require" of pug in the page

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content