I have created my own little Symfony2 form type. For this to work properly, I need to include a js library. While that was a simple task when using this new form type in a single web application, it became way more difficult when I decided to move that form type to a dedicated bundle in order to make it reusable.
For now, I am aware of two possible solutions
1) Ask everyone who is using my bundle to add a line into their base.html.twig
2) Add a <script>
tag for embedding the library to my form widget
Both of them are not very smart so my question is: how do I do this better? Especially, if my form type can be included several times on a single page. And even worse, if my form type is requiring e.g. JQuery to be present, but I do not know, if JQuery has already been loaded in the application.