Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 2 months ago
JSON representation

Integration with your Symfony app & Vite

Awesome Lists containing this project

README

        



Symfony logo





# ViteBundle : Symfony integration with Vite

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.

⚠️ 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.

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.

## 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-bundle](https://github.com/lhapaipai/vite-bundle) | Symfony Bundle (read-only)|
| [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).