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.
If you want to open issues, contribute, make PRs or consult examples you will have to go to the symfony-vite-dev repository.
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 %}
Package | Description |
---|---|
vite-bundle | Symfony Bundle (read-only) |
vite-plugin-symfony | Vite plugin (read-only) |
symfony-vite-dev | Package for contributors |
MIT.