Express Migrating from Jade to Pug 2
You are Welcome! This Tip Shows You How to Migrate from Jade to Pug 2 Express Application.
Pug 2 was released in August 2016. To make improvements in the new release potential, they had to make the decision of deprecating or removing some APIs and undocumented language features.
1. Installing Pug
First, to Install Pug
sudo npm i -g pug
2. Changing Template Engine
Edit the app.js File and Change:
app.set('view engine', 'jade')
app.set('view engine', 'pug')
This from stackoverflow.com
3. Renaming Views Files
Switch from .jade to .pug
So for Instance:
mv error.jade error.pug
4. Indenting Consistently
Make the Same Spaces/Tabs Value on All Layout’s file Rows.
So now, if Identation Begin we say with 2 Spaces the Continue to Indent the same Value.
So Now I’m truly Happy if My Guide could Help You to Migrate from Jade to Pug 2!