Template Generator
Create a theme template
#
UsageBy default, Nx will search for the template
generator in the default collection provisioned in workspace.json
.
You can specify the collection explicitly as follows:
Show what will be generated without writing to disk:
#
ExamplesGenerate a template in the my-theme theme:
This creates the following files:
Then you should add the generated template to the apps/my-theme/src/theme/templates/theme-templates.ts
exported themeTemplates
object so the new template is loaded in the bootstrap process:
tip
If want to know more about how the theme-templates.ts
file works, head to the Theme Boostrap Process doc
#
Options#
--nameType: string
The name of the template.
#
--projectAlias(es): p
Type: string
The name of the project where the template will be generated.
#
--directoryAlias(es): d
Type: string
Create the template under this directory relative to src/theme/templates (can be nested).
#
--flatDefault: false
Type: boolean
Create template files at the directory root rather than its own directory.
#
--liquidOnlyDefault: false
Type: boolean
When true, does not create files other than the liquid file for the new template.
#
--skipTestsDefault: false
Type: boolean
When true, does not create \"spec.ts\" test files for the new template.