Domanda

So this question revolves around the command line and node.js. I know using express app creates a folder named app loaded with files ready to run npm install and then node app.js

What I would like to do is create something similar, but use my configuration. I use handlebars for my templating system instead of Jade and have structured my folders nicely for base project. I currently have to copy and paste my folder, but I know there is a better way to do this.

Thanks again Guru Masters!

È stato utile?

Soluzione

It essentially boils down to writing an app that creates / copies files and directories, adding some custom data to some of them. Most of the things you need to achieve that can be found in the file system module.

You could take a look at the source code to the express app to see how they do it.

Alternatively you could look at Yeoman, which covers this (and a few other things) in a more generic way. The specific bit for setting up a new project from a template is a generator and they have instructions on how to write your own.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top