https://github.com/lhapaipai/vite-bundle
Integration with your Symfony app & Vite
https://github.com/lhapaipai/vite-bundle
bundle php symfony symfony-bundle vitejs
Last synced: 28 days ago
JSON representation
Integration with your Symfony app & Vite
- Host: GitHub
- URL: https://github.com/lhapaipai/vite-bundle
- Owner: lhapaipai
- License: mit
- Created: 2021-04-11T09:31:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-23T21:06:02.000Z (8 months ago)
- Last Synced: 2025-04-13T15:08:47.583Z (7 months ago)
- Topics: bundle, php, symfony, symfony-bundle, vitejs
- Language: PHP
- Homepage: https://symfony-vite.pentatrion.com
- Size: 298 KB
- Stars: 252
- Watchers: 11
- Forks: 25
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-vite - Vite Bundle - Integration for Symfony. (Integrations with Backends / Symfony)
- awesome-vite - Vite Bundle - Integration for Symfony. (Integrations with Backends / Symfony)
README

# ViteBundle : Symfony integration with Vite
> [!IMPORTANT]
> This repository is a "subtree split": a read-only subset of that main repository [symfony-vite-dev](https://github.com/lhapaipai/symfony-vite-dev) which delivers to packagist only the necessary code.
> [!IMPORTANT]
> If you want to open issues, contribute, make PRs or consult examples you will have to go to the [symfony-vite-dev](https://github.com/lhapaipai/symfony-vite-dev) repository.
This bundle helps you render all the dynamic `script` and `link` tags needed.
Essentially, it provides two twig functions to load the correct scripts into your templates.
## Installation
Install the bundle with:
```console
composer require pentatrion/vite-bundle
```
```bash
npm install
# start your vite dev server
npm run dev
```
Add these twig functions in any template or base layout where you need to include a JavaScript entry:
```twig
{% block stylesheets %}
{{ vite_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ vite_entry_script_tags('app') }}
{# if you are using React, you have to replace with this #}
{{ vite_entry_script_tags('app', { dependency: 'react' }) }}
{% endblock %}
```
[Read the Docs to Learn More](https://symfony-vite.pentatrion.com).
## Ecosystem
| Package | Description |
| ----------------------------------------------------------------------- | :------------------------ |
| [vite-plugin-symfony](https://github.com/lhapaipai/vite-plugin-symfony) | Vite plugin (read-only) |
| [symfony-vite-dev](https://github.com/lhapaipai/symfony-vite-dev) | Package for contributors |
## License
[MIT](LICENSE).