Home » Nodejs » Express Generator Without Jade

Express Generator Without Jade

Posted by: admin December 5, 2017 Leave a comment


I am trying to generate an express skeleton, using the express generator.
So it would be this:

$ npm install express-generator -g

However, it adds a bunch of automatic jade files.

I was wondering if there was a way to get rid of those jade files and just using html with the express generator



Try this command in command prompt,

express –help, it will give you the following

Express help

The above image gives you the list of “view engines”,
now, simply type

express -{your choice view engine}
For example, express -e

This sets the EJS as your view handler and removes jade. EJS has the look and feel of HTML with the added ability to inject values via their template system.


You can check the documentation Express-Generator.

As you can see with express -h the view engine suported by express generator are
(ejs|hbs|hjs|jade|pug|twig|vash), but by deafult jade is suported.

$ express -h

Usage: express [options][dir]


-h, --help          output usage information
    --version       output the version number
-e, --ejs           add ejs engine support
    --hbs           add handlebars engine support
    --pug           add pug engine support
-H, --hogan         add hogan.js engine support
-v, --view <engine> add view <engine> support (ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)
-c, --css <engine>  add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
    --git           add .gitignore
-f, --force         force on non-empty directory


You can just delete the jade files and hook up your own template engine.

For example, I like using Handlebars.js. So in order to use that, in app.js or server.js or whatever the generator names the main file, you’d substitute the line:

app.set('view engine', 'jade');

with something along the lines of this (after installing and requiring handlebars, at least):

app.engine('handlebars', exphbs({defaultLayout: 'main'}));
app.set('view engine', 'handlebars');

And every engine is as configurable as you want it o be.


This generator seems to handle EJS templates. EJS is just HTML with the ability to insert variables. Well… Like a templating engine.
But EJS is also the rendering engine for HTML.

In the app.js of the generator you can see this line (15):

app.set('view engine', '{views}');

So my guess is that if you select the EJS engine when installing, it will be good. As long as you put your html files in the specified folder (line 14, app.js):

app.set('views', path.join(__dirname, 'views'));


You can also directly include your html file into your jade file

include ../../public/index.html

Leave a Reply

Your email address will not be published. Required fields are marked *