Note that there are some explanatory texts on larger screens.

plurals
  1. POManaging common javascript dependencies in Symfony 2
    primarykey
    data
    text
    <p>I would like to know what is the standard best practice for dealing with common JavaScript (and even CSS) dependencies across several Symfony 2 bundles.</p> <p>According to the <a href="http://symfony.com/doc/current/book/bundles.html#vendors">Book on the official Symfony site</a>:</p> <p><code>A bundle should not embed third-party libraries written in JavaScript, CSS, or any other language.</code> </p> <p>This seems to be logical, but there is no recommendation on how to actually declare, or require common asset dependencies such as jQuery, or more importantly, <strong>particular plugins</strong> for jQuery. I've emphasized particular plugins because just including a well known, almost always used JS framework in the application layout would be "sort of okay", but a plugin is required just in case it's going to be used.</p> <p>So if I shouldn't put it in the Resources directory of my bundle, then my questions are the following:</p> <ul> <li><strong>where to put the third party code</strong></li> <li><strong>how do I reference it</strong></li> <li><strong>how should other bundles reference the very same plugin (preferably the same physical file)</strong></li> <li><strong>how not to require the same assets more than once</strong></li> </ul> <p>Without knowing any methods to solve this problem, I've thought of adding instructions to my bundle's documentation to include the required libs in the layout file, but there have to be cleaner solutions.</p> <p>Any thoughts on this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload