Skip to content

Commit

Permalink
docs(guide): how to install vite for project + minimal index.html demo (
Browse files Browse the repository at this point in the history
  • Loading branch information
hchiam committed Jun 7, 2024
1 parent 5739393 commit e3c8278
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,34 @@ npm install
npm run dev
```

## Install `vite` Command

You can install the CLI command `vite` for your project using:

```bash
npm install vite
```

Or with yarn:

```bash
yarn add vite
```

Now you can create an index.html file like this:

```html
<p>Hello Vite!</p>
```

Then simply run:

```bash
vite
```

And index.html will be served on http://localhost:5173

## `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.
Expand All @@ -122,10 +150,6 @@ Note that Vite will also resolve [its config file (i.e. `vite.config.js`)](/conf

## Command Line Interface

You can install the CLI command `vite` globally with `npm install -g vite` or `yarn global add vite`.

Or install it for a specific project with `npm install vite` or `yarn add vite`.

In a project where Vite is installed, you can use the `vite` binary in your npm scripts, or run it directly with `npx vite`. Here are the default npm scripts in a scaffolded Vite project:

<!-- prettier-ignore -->
Expand Down

0 comments on commit e3c8278

Please sign in to comment.