Skip to content

Commit

Permalink
Update the README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Demetrius Johnson committed May 19, 2011
1 parent 3b06b53 commit 435e71e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# NGen Template Tsing NPM
# NGen Template Using NPM

This is an example of a ngen template. You can find out more about ngen at [github.com/visionmedia/ngen](https://github.com/visionmedia/ngen). Basically nget creates a project skeleton for you by taking a template and asking you a few questions that it will substitute your answers to make a custom version on the template. This time saver makes it a breeze to setup a new project without having to copy, rename files, and scrubbing out existing code from your files.
This is an example of a ngen template. You can find out more about ngen at [github.com/visionmedia/ngen](https://github.com/visionmedia/ngen). Basically nget creates a project skeleton for you by taking a template and asking you a few questions that it will substitute your answers to make a custom version of the template. This time saver makes it a breeze to setup a new project without having to copy, rename files, and scrubbing out existing code from your files.

To get started, you will need to create a file that defines the questions you are going to ask the user. We will use this list of answers later in the substitution phase. Here is an example below, look at the lable and then string. The lable is what is substituted in the template and the string is the prompt the user sees.

Expand All @@ -12,7 +12,7 @@

Next you need to create a directory, that will contain all the files that will make up your skeleton. This directory is named content. What makes ngen cool is that it will rename files and replace file contents using regex that looks for anything in the form of {{variable}}. For example, if you have a file name {{name}}.js and the user answers the question "Enter your name: " with "fooman" the file will be renamed to foomain.js. It also checks the contents of the file and substitutes any matches so if a file has a line of code like "console.log('{{name}}');" ngen will update the file contents to "console.log('fooman');"

./content/{{name}}.js -> your_new_project/fooman.js
./content/{{name}}.js -> your_new_project/fooman.js
console.log('{{name}}'); -> console.log('fooman');

We are almost done, the last step is to add the template to your private npm registry or share it with the world by publishing it. as a convention I recommend naming your template ngen-somthing for example, if you have a template for connect it would be ngen-connect. Just rememeber to make "Main module/entry point" index.js.
Expand Down

0 comments on commit 435e71e

Please sign in to comment.