Skip to content

Commit

Permalink
Add AssetUrl example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hlubek authored May 7, 2024
1 parent 4cd0904 commit 804f93e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ Go to your site package:
cd DistributionPackages/Your.Site
```

1. Install the package via composer
### 1. Install the package via composer

```bash
composer require networkteam/neos-vite
```

2. Install Vite via NPM (or Yarn, pnpm):
### 2. Install Vite via NPM (or Yarn, pnpm):

```bash
npm install --save-dev vite
```

3. Create a `vite.config.mjs` file in your site package:
### 3. Create a `vite.config.mjs` file in your site package:

```js
import { defineConfig } from "vite";
Expand All @@ -45,7 +45,7 @@ export default defineConfig((configEnv) => ({
}));
```

4. You can now include Vite assets for development / production in your Fusion files:
### 4. You can now include Vite assets for development / production in your Fusion files:

```fusion
header = Networkteam.Neos.Vite:Asset {
Expand All @@ -69,6 +69,18 @@ prototype(Networkteam.Neos.Vite:Asset) {
}
```

### Bonus: You can generate the URL to entries in the manifest

This will only return the URL to the file for an entry without considering imports.

Example for an SVG spritemap (using [vite-plugin-svg-spritemap](https://github.com/SpiriitLabs/vite-plugin-svg-spritemap)):

```fusion
src = Networkteam.Neos.Vite:AssetUrl {
entry = 'spritemap.svg'
}
```

## Multi-site

Configure individual Vite configurations for each site by adding a Vite setup with a corresponding `vite.config.mjs` file in _each_ site package.
Expand Down

0 comments on commit 804f93e

Please sign in to comment.