lhapaipai / vite-bundle

Integration with your Symfony app & Vite

Home Page:https://symfony-vite.pentatrion.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing encore functions "encore_entry_css_files" and "encore_entry_js_files"

wojto opened this issue · comments

In Webpack Encore we have those two functions encore_entry_css_files and encore_entry_js_files.
It would be nice if we have similar functions for Vite, otherwise it's difficult to replace Encore with Vite.

I wojto, has you can see if you observe the generated entrypoints.json there is

  • css
  • js
  • preloaded-js
  • dynamic-preloaded-js
  • assets

associated to one entry point.

in dev mode there is also inline content added.

it's not only an array of js file and an array of css files.

if you have a specific use case you can develop your own twig functions EntrypointRenderer and EntrypointsLookup can be injected has dependencies in your TwigExtension.

hoping to help you move forward with your proposal

doc: https://symfony-vite.pentatrion.com/guide/tips.html#dependency-injection
current twig functions: https://github.com/lhapaipai/vite-bundle/blob/main/src/Twig/EntryFilesTwigExtension.php

Hi @wojto,
with v5.x you can define listeners to add/remove/modify your <script>/<link> on the runtime. I think it can be helpful for you ?
migration v4->v5
custom attributes