Skip to content

Commit

Permalink
Update the Readme.md to link the template example
Browse files Browse the repository at this point in the history
  • Loading branch information
Demetrius Johnson committed May 19, 2011
1 parent d26562c commit 623108a
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions Readme.md
Expand Up @@ -46,30 +46,9 @@ structure:

It is possible to install additional templates by using npm. You can install community templates or create your own by adding them to your local npm registry.

After installing the template, you can use the -n or --npm flag to specify the npm package as a template. As a convention, the npm packages should be named with ngen- then the name for example, a connect based template would be named ngen-connect.
After installing the template, you can use the -n or --npm flag to specify the npm package as a template. As a convention, the npm packages should be named with ngen-npm_package for example, a connect based template would be named ngen-connect.

Lets make a new template, starting by creating a directory containing index.js and a sub folder named content. The index.js defines the variables used to substitute when building the template. The content folder contains a skeleton copy of the files.

ngen substitutes anything following the format of "{{token}}" where token is any one of the variables in the index.js file. Both file names and the file content will be updated. So if, you have a file name {{name}}.test.js and name = foo ngen will output a file named foo.test.js. Finally if, the file contains "var name = '{{name}}';" it will be updated to "var name = 'foo';"

The index.js is a list of exported variables with related prompts. The cli uses this file to generate the prompts to get the values for the substation. For example, the name variable will use the prompt "Enter your name: "

exports.variables = {
project: 'Project name: '
, name: 'Enter your name: '
, email: 'Enter your email: '
, description: 'Project description: '
};

required template structure:

./index.js
./package.json
./content/

example file substitution:

./content/{{name}}.test.js
If you would like to start making your own templates and sharing them with the community you can check out [ngen-basicexample]{https://github.com/demetriusj/ngen-basicexample} for additional help on making a template.

## License

Expand Down

0 comments on commit 623108a

Please sign in to comment.