Skip to content

Commit cafd602

Browse files
kevinoldianschmitz
andauthored
Update custom template docs with instructions for testing custom template locally (#8092)
Co-authored-by: Ian Schmitz <ianschmitz@gmail.com>
1 parent 720d90b commit cafd602

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docusaurus/docs/custom-templates.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,8 @@ You'll notice that Custom Templates are always named in the format `cra-template
1111

1212
Scoped templates are also supported, under the name `@[scope-name]/cra-template` or `@[scope-name]/cra-template-[template-name]`, which can be installed via `@[scope]` and `@[scope]/[template-name]` respectively.
1313

14-
### npm
15-
16-
```sh
17-
npm init react-app my-app --template [template-name]
18-
```
19-
20-
### Yarn
21-
2214
```sh
23-
yarn create react-app my-app --template [template-name]
15+
npx create-react-app my-app --template [template-name]
2416
```
2517

2618
## Finding custom templates
@@ -52,6 +44,14 @@ my-app/
5244
index.js (or index.tsx)
5345
```
5446

47+
### Testing a template
48+
49+
To test a template locally, pass the file path to the directory of your template source using the `file:` prefix.
50+
51+
```sh
52+
npx create-react-app my-app --template file:../path/to/your/template/cra-template-[template-name]
53+
```
54+
5555
### The `template` folder
5656

5757
This folder is copied to the user's app directory as Create React App installs. During this process, the file `gitignore` is renamed to `.gitignore`.

0 commit comments

Comments
 (0)