bohnmedia/contao-vite-bundle

Integrates pentatrion/vite-bundle into Contao 5 and exposes Vite entry tags and asset URLs via both Twig functions and insert tags.

Maintainers

Package info

github.com/bohnmedia/contao-vite-bundle

Type:contao-bundle

pkg:composer/bohnmedia/contao-vite-bundle

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.3.1 2026-05-21 09:51 UTC

This package is auto-updated.

Last update: 2026-05-21 09:56:31 UTC


README

A small Contao 5 wrapper around pentatrion/vite-bundle. It registers PentatrionViteBundle in Contao Manager Edition so its Twig functions work out of the box, and additionally exposes the most common rendering helpers as Contao insert tags for use outside of templates.

Installation

composer require bohnmedia/contao-vite-bundle

By default the bundle expects Vite to output its build artifacts into public/build/. Both parts of that path can be overridden through the underlying pentatrion_vite configuration:

# config/config.yaml
pentatrion_vite:
    public_directory: public   # default: public
    build_directory: build     # default: build

See the pentatrion/vite-bundle reference for all available configuration options.

Rendering entry tags

Render the link and script tags for a Vite entry.

Twig

{{ vite_entry_link_tags('app') }}
{{ vite_entry_script_tags('app') }}

Insert tag

{{vite_entry_link_tags::app}}
{{vite_entry_script_tags::app}}

The insert tags behave like the Twig functions they wrap: an unknown entry resolves to an empty string by default, unless you enable throw_on_missing_entry in the configuration.

Resolving individual asset URLs

A named asset package vite is registered automatically, so Vite-hashed assets resolve via Symfony's asset() function or Contao's {{asset::}} insert tag.

Twig

{{ asset('@/images/favicon.svg', 'vite') }}

Insert tag

{{asset::@/images/favicon.svg::vite}}

License

MIT.