Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for custom templates option #630

Merged
merged 4 commits into from
Dec 17, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions app/pages/docs/cli-generate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,49 @@ app/tasks/mutations/updateTask.ts
Note that this will not generate the relationships between the models,
only the queries, mutations and pages.

##### `--templateDir`

Shorthand: `-t`

Allows you to specify a custom template directory. If you want to use
custom templates insetad of the default ones (e.g. with different styles),
you can pass a path to the local template directory. The template
directory should have the following structure:

```bash
.
├── form
│ └── __ModelName__Form.tsx
├── mutation
│ └── __input__.ts
├── mutations
│ ├── create__ModelName__.ts
│ ├── delete__ModelName__.ts
│ └── update__ModelName__.ts
├── page
│ ├── __modelIdParam__
│ │ └── edit.tsx
│ ├── __modelIdParam__.tsx
│ ├── index.tsx
│ └── new.tsx
├── queries
│ ├── get__ModelName__.ts
│ └── get__ModelNames__.ts
└── query
└── __name__.ts
```

If some folders are omitted in your custom template directory,
`blitz generate` will fallback to the default templates. You can check
them out
[here](https://github.com/blitz-js/blitz/tree/canary/packages/generator/templates).

**Usage:**

```bash
blitz generate all projects -t ./my-custom-templates
```

##### `--dry-run`

Shorthand: `-d`
Expand Down