# fhvite


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Usage

### Installation

Install the latest version from
[GitHub](https://github.com/AnswerDotAI/fhvite):

``` bash
uv pip install git+https://github.com/AnswerDotAI/fhvite.git
```

This project requires [bun](https://bun.sh) to function properly. It
will be automatically installed on first run if not already installed in
the path

## How to use

Import into an existing FastHTML application and add the following:

``` python
from fasthtml.common import *

# Add this import
from fhvite.core import add_vite

app = FastHTML()

# Add this line
add_vite(app)
```


    > fastvite@0.0.0 build
    > vite build

    vite v7.0.4 building for production...
    transforming...
    ✓ 3 modules transformed.
    rendering chunks...
    computing gzip size...
    ../dist/.vite/manifest.json          0.19 kB │ gzip:  0.14 kB
    ../dist/assets/index-DwAzhI66.css  215.53 kB │ gzip: 25.35 kB
    ../dist/assets/index-DSGW5Iaw.js     0.71 kB │ gzip:  0.40 kB
    ✓ built in 103ms

All necessary setup files will be generated if not already present.
After that, subsequent server starts will simply build the assets and
inject them into the app header.

The plugin function also mounts a starlette `StaticFiles` route
automatically, making the generated assets benefit from proper cacheing
and static serving rules.
