Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js noobie trying to follow a tutorial - need to change jade reference to pug

I'm trying to follow this tutorial to learn about node.js:

http://cwbuecheler.com/web/tutorials/2014/restful-web-app-node-express-mongodb/

When I run "npm install" some of the messages I see include this:

npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Deprecated, use jstransformer

And then it goes ahead and seems to set up the application anyways. My package.json file currently looks like this:

{
  "name": "testapp",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0",
    "mongodb": "^1.4.4",
    "monk": "^1.0.1"
  }
}

Questions: (these questions apply to both packages that I got warned about, but for discussion purposes, I'm just going to pick on jade / pug)

If I wanted to change jade to pug, do i need to specify a version number in this package.json file? Or can I just tell it to get latest somehow? Also, do I need to blow away my folder structure and then rerun the npm install command? Or can I just edit the package.json file and retry npm install?

Lastly, based on your experience, how critical is it for me to change from jade to pug if i'm just trying to learn how node works? I'm tempted to just leave as is... but then again, if this app works, i know it's going to be rolled out into production.. so... i guess i should make the right decisions up front.

Thanks and sorry if my questions are really remedial.

like image 681
Happydevdays Avatar asked Jul 29 '16 20:07

Happydevdays


People also ask

Is Jade deprecated?

Although . jade is still supported, it is deprecated.

What is pug in node js?

Pug in node. js is a template engine that uses case sensitive syntax to generate html, in other words it returns a string of html rendered as per data specified in a pug file. We can say that pug is the middleman who plays a role to convert the injected data and translate it into html syntax.


1 Answers

looks like you have a few questions so I'll go through them in order. If you want to change jade to pug you can run the following from the command line:

npm uninstall jade --save

then

npm install pug --save 

unless you specify the version when installing by saying [email protected] for example you will get the current version. Here is the documentation for how you can specify versions in your JSON https://docs.npmjs.com/files/package.json but you can specify a specific version or a specify major or minor version. It really depends on what you want to do.

in order to remove modules that are not in your package.json file use the prune command:

npm prune

This should remove modules not listed in your json (as long as they aren't dependencies)

I believe Jade was forced to change their name in npm due to copyright issue. I think it would be a good idea to use the current name so you can stay up to date if there are changes to the package

nb:make sure to change the extension to .pug from .jade

like image 86
SeanKelleyx Avatar answered Sep 22 '22 10:09

SeanKelleyx