docs: improve community templates section (#15133)

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
patak 2023-11-28 09:03:47 +01:00 committed by GitHub
parent ef403c0e61
commit 339b20c5fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,22 +89,20 @@ See [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite)
## Community Templates
create-vite is a tool to quickly start a project from a basic template for popular frameworks. Check out Awesome Vite for [community maintained templates](https://github.com/vitejs/awesome-vite#templates) that include other tools or target different frameworks. You can use a tool like [degit](https://github.com/Rich-Harris/degit) to scaffold your project with one of the templates.
create-vite is a tool to quickly start a project from a basic template for popular frameworks. Check out Awesome Vite for [community maintained templates](https://github.com/vitejs/awesome-vite#templates) that include other tools or target different frameworks.
For a template at `https://github.com/user/project`, you can try it out online using `https://github.stackblitz.com/user/project` (adding `.stackblitz` after `github` to the URL of the project).
You can also use a tool like [degit](https://github.com/Rich-Harris/degit) to scaffold your project with one of the templates. Assuming the project is on GitHub and uses `main` as the default branch, you can create a local copy using:
```bash
npx degit user/project my-project
npx degit user/project#main my-project
cd my-project
npm install
npm run dev
```
If the project uses `main` as the default branch, suffix the project repo with `#main`
```bash
npx degit user/project#main my-project
```
## `index.html` and Project Root
One thing you may have noticed is that in a Vite project, `index.html` is front-and-central instead of being tucked away inside `public`. This is intentional: during development Vite is a server, and `index.html` is the entry point to your application.