The meta of a template document is called Attributes. Several options can be combined for flexible file generation.
List of attributes that can be specified with Front Matter.
|Name of template.|
|The directory as the starting point of the output destination.|
|Directory starting from |
|Directory to exclude from candidate output destination. You can use glob syntax. (see globby document)|
|Message to display when accepting input.|
questions is a protocol for accepting the necessary input for the template. scaffdog provides several options so that you can define a suitable question type.
Invokes the most commonly used prompt that accepts strings.
questions:# syntax sugarvalue1: 'Please enter any text.'# with messagevalue2:message: 'Please enter any text.'# with default valuevalue3:message: 'Please enter any text.'initial: 'scaffdog'
Invoke a prompt that accepts a Boolean.
questions:# basicbool1:confirm: 'Do you need something?'# with default valuebool2:confirm: 'Do you need something?'initial: false
Invokes a prompt to select a single value from a list.
questions:# basicvalue1:message: 'Please select a value.'choices:- 'A'- 'B'- 'C'# with default valuevalue2:message: 'Please select a value.'choices:- 'A'- 'B'- 'C'initial: 'B'
Invokes a prompt to select multiple selections from the list.
questions:# basicvalue1:message: 'Please select a value.'multiple: truechoices:- 'A'- 'B'- 'C'# with default valuevalue2:message: 'Please select a value.'multiple: truechoices:- 'A'- 'B'- 'C'initial: ['B']
If the result of the expression in the
if field is
true, Prompt is invoked. If it
false, skip Prompt and assign initial values. The initial value is assigned to the
initial field if it exists. If not, a zero value is assigned according to the Prompt type.
questions:name:message: 'Please enter a component name.'# Invokes confirm prompt only when input includes "Form".test:if: contains(inputs.name, 'Form')confirm: 'Do you need a test?'
This is useful when you want to use a Prompt that is only needed for some use cases in the target file.
Last edited on