Skip to content

lhapaipai/vite-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Feb 23, 2025
e5657ed · Feb 23, 2025
Feb 11, 2025
Oct 27, 2023
Aug 13, 2024
Feb 10, 2025
Feb 23, 2025
Oct 21, 2024
Feb 13, 2024
Nov 2, 2023
Jan 10, 2024
Feb 23, 2025
Nov 10, 2023
Aug 22, 2024
Sep 2, 2024
Feb 15, 2024
Feb 13, 2024
Oct 27, 2023

Repository files navigation

Symfony logo

ViteBundle : Symfony integration with Vite

Important

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.

Important

If you want to open issues, contribute, make PRs or consult examples you will have to go to the 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:

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-plugin-symfony Vite plugin (read-only)
symfony-vite-dev Package for contributors

License

MIT.