How to Migrate From Jade to Pug 2 Express App

July 24, 2018 | By the+gnu+linux+evangelist.

Express Migrating from Jade to Pug 2

Hi! 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.

How to Migrate from Jade to Pug 2 Express App - Featured
  1. 1. Installing Pug

    First, to Install Pug.

    sudo npm i -g pug
  2. 2. Changing Template Engine

    Edit the app.js File and Change:

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

    In:

    app.set('view engine', 'pug')

    This from stackoverflow.com

  3. 3. Renaming Views Files

    Switch from .jade to .pug.

    cd views

    So for Instance:

    mv error.jade error.pug
  4. 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.

  5. So Now I’m truly Happy if My Guide could Help you to Migrate from Jade to Pug 2!


QuickChic Theme • Powered by WordPress