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

Docs for Custom Templates PR #781

Merged
merged 4 commits into from
Oct 12, 2022
Merged
Changes from all commits
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
23 changes: 19 additions & 4 deletions app/pages/docs/cli-generate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,25 @@ field to the `Task` model.
blitz generate model task subheading:string
```

<!--
### Custom templates {#custom-templates}

If you want to use custom templates with `blitz generate` instead of the
default ones (e.g. with different styles), you can provide a path to the
local directory with template files. You can specify it in your
`blitz.config.ts` file. [Read more here](/docs/blitz-config#codegen). -->
default ones (e.g. with different styles). You can specify it in your `app/blitz-server`
file by exporting the `cliConfig` object

```ts
import type { BlitzCliConfig } from "blitz"
...
export const cliConfig: BlitzCliConfig = {
customTemplates: "app/templates",
}
```

#### Generate custom templates

```bash
blitz generate custom-templates
```
The above command will generate the default templates used by blitz to a directory of your choosing in order
to provide a starting point to use this feature. It will also update the `cliConfig` configuration, in the `app/blitz-server` file,
with the latest data to allow immediate usage.