Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Express Generator Without Jade

Tags:

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

Thanks!

like image 352
Richard WU Avatar asked Jun 04 '15 02:06

Richard WU


People also ask

What is Jade in Express?

Jade is a template engine for node. js and the default rendering engine for the Express web framework. It is a new, simplified language that compiles into HTML and is extremely useful for web developers. Jade is designed primarily for server-side templating in node.

What is Express View Engine?

Overview. View engines allow us to render web pages using template files. These templates are filled with actual data and served to the client. There are multiple view engines, the most popular of which is Embedded Javascript (EJS).

Can you use HTML with Express?

You don't need to install any extra modules to render an HTML file in Express. Just install express and you are good to go.


1 Answers

Try running this command in command prompt:

express --help 

It will give you the express generator help:

  Usage: express [options] [dir]    Options:      -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         --no-view       generate without view engine     -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 

Source: https://expressjs.com/en/starter/generator.html

The above options give you the list of "view engines".

Now, simply type:

express -{your choice view engine}


For example using express -e:

This sets the EJS engine 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.

like image 131
Harsha Kasturi Avatar answered Oct 06 '22 15:10

Harsha Kasturi