Skip to content

Latest commit

 

History

History
68 lines (45 loc) · 2.3 KB

README.md

File metadata and controls

68 lines (45 loc) · 2.3 KB

Symfony logo

ViteBundle : Symfony integration with Vite

This bundle helping you render all of the dynamic script and link tags needed. Essentially, he 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 this 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.