@@ -135,6 +135,22 @@ available:
135135
136136Put your template files anywhere , and fill them with tokens for replacement .
137137
138+ Each template (not file ) in the config array is parsed individually , and copied to the output
139+ directory . If a single template path contains multiple files (e .g . if you use a folder path or a
140+ glob pattern ), the first directory up the tree of that template will become the base inside the
141+ defined output path for that template , while copying files recursively and maintaining their
142+ relative structure .
143+
144+ Examples :
145+
146+ > In the following examples , the config ` name ` is ` AppName ` , and the config ` output ` is ` src ` .
147+
148+ | Input template | Output path (s ) |
149+ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
150+ | ` ./templates/{{ name }}.txt ` | ` src/AppName.txt ` |
151+ | ` ./templates/directory ` < br / > <br /> Directory contents :<br /> <ol ><li >` outer/{{name}}.txt ` < / li > </li ><li >` outer2/inner/{{name.txt}} ` < / li > </ol > | ` src/outer/AppName.txt ` ,<br />` src/outer2/inner/AppName.txt ` |
152+ | ` ./templates/others/**/*.txt ` < br / > <br /> Directory contents :<br /> <ol ><li >` outer/{{name}}.jpg ` < / li > </li ><li >` outer2/inner/{{name.txt}} ` < / li > </ol > | ` src/outer2/inner/AppName.txt ` |
153+
138154### Variable / token replacement
139155
140156Scaffolding will replace ` {{ varName }} ` in both the file name and its contents and put the
@@ -146,7 +162,11 @@ The data available for the template parser is the data you pass to the `data` co
146162For example , using the following command :
147163
148164` ` ` bash
149- npx simple-scaffold@latest --templates templates/components/{{name}}.jsx --output src/components -create-sub-folder true MyComponent
165+ npx simple-scaffold@latest \
166+ --templates templates/components/{{name}}.jsx \
167+ --output src/components \
168+ -create-sub-folder true \
169+ MyComponent
150170` ` `
151171
152172Will output a file with the path :
@@ -165,7 +185,8 @@ Your `data` will be pre-populated with the following:
165185> Simple - Scaffold uses [Handlebars .js ](https :// handlebarsjs.com/) for outputting the file contents.
166186> Any ` data ` you add in the config will be available for use with their names wrapped in
167187> ` {{ ` and ` }} ` . Other Handlebars built - ins such as ` each ` , ` if ` and ` with ` are also supported , see
168- > [Handlebars .js Language Features ](https :// handlebarsjs.com/guide/#language-features) for more information.
188+ > [Handlebars .js Language Features ](https :// handlebarsjs.com/guide/#language-features) for more
189+ > information .
169190
170191#### Helpers
171192
0 commit comments