Is there any way to use multiple view engines with Express + Node.js

Amol M Kulkarni picture Amol M Kulkarni · Feb 25, 2013 · Viewed 16.4k times · Source

Scenario: I had developed some transactional pages using Node.js, Express + Handlebars as view engine and MongoDB.

Now the issue is during module integration I got some of the pages which are built on Express + Jade as view engine.

Question: How to integrate pages built on Handlebars & some on Jade?

Answer

Sergii picture Sergii · Feb 25, 2013
  1. Add both engines and consolidate.js in your package.json
  2. In yourapp.js

    var engines = require('consolidate');

    app.engine('jade', engines.jade);

    app.engine('handlebars', engines.handlebars);

More info here