Using Template Scaffolds
This guide explains how to use template scaffolds to generate files within an existing project using templates in your project's .scaffolds directory.
Basic Usage
To generate new files using a template scaffold, use the scaffold new command followed by the template name:
# Generate files using a template
scaffold new componentInteractive Prompts
When you run the command, you'll enter an interactive prompt that asks questions required to render the template:
? Component Name: UserProfile
? Component Type: Functional
? Include Tests: YesThe answers you provide will customize the generated files according to the template's design.
Output Location
By default, template scaffolds will generate files in your current directory according to the rules defined in the template.
You can override the base output directory using the --output-dir flag:
scaffold new --output-dir ./src/components componentProject-Specific Templates
Project-specific templates are stored in the .scaffolds directory of your project:
project/
├── .scaffolds/
│ ├── component/
│ │ ├── scaffold.yaml
│ │ └── templates/
│ │ └── ...
│ └── page/
│ ├── scaffold.yaml
│ └── templates/
│ └── ...
└── src/
└── ...To use these templates, simply provide the template name:
scaffold new componentA full list of flags and options is available with scaffold new --help