pentatrion/vite-bundle

Vite integration for your Symfony app

Installs: 372 727

Dependents: 6

Suggesters: 0

Security: 0

Stars: 197

Watchers: 9

Forks: 21

Open Issues: 3

Type:symfony-bundle

v6.4.4 2024-04-20 19:25 UTC

README

Symfony logo

68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70656e74617472696f6e2f766974652d62756e646c653f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c68617061697061692f73796d666f6e792d766974652d6465762f766974652d62756e646c652d63692e796d6c3f7374796c653d666c61742d737175617265266c6162656c3d766974652d62756e646c652532304349266c6f676f3d676974687562

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 which delivers to packagist only the necessary code.

If you want to view the source code or open issues you are in the right place.

If you want to contribute, make PRs or consult examples you will have to go to the symfony-vite-dev repository.

Installation

Install the bundle with:

composer require pentatrion/vite-bundle
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:

{% 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.

Ecosystem

Package Description
vite-bundle Symfony Bundle (read-only)
vite-plugin-symfony Vite plugin (read-only)
symfony-vite-dev Package for contributors

License

MIT.