Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install/update javascript vendors in symfony2 project?

Tags:

symfony

In my Symfony2 project I have a number of javascript dependencies and it would be nice to have them managed along with php dependencies. Right now I am adding them to the deps file along with php dependencies and create a symlink to the web dir, for example:

//deps
[knockout-js]
    git=git://github.com/SteveSanderson/knockout.git

The problem is that javascript libraries (most of them) need to be compiled from several files into one. So after installing/updating vendors, I need to go and run compilation scripts by hand. As far as I know, bin/vendors script does not support pre/post update hooks, which would solve this problem.

Anyways, how do you approach updating of javascript vendors in your projects?

like image 675
Dziamid Avatar asked Jul 03 '12 19:07

Dziamid


1 Answers

There may be fancier ways... but I just use the paths in my base template like so:

{% javascripts
    filter='yui_js'

    '../vendor/twitter/bootstrap/js/bootstrap-tab.js'
    '../vendor/harvesthq/chosen/coffee/lib/select-parser.coffee'
    '../vendor/harvesthq/chosen/coffee/lib/abstract-chosen.coffee'
    '../vendor/harvesthq/chosen/coffee/chosen.jquery.coffee'

    '@SOTBCoreBundle/Resources/public/js/script.js'
%}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}
like image 142
MDrollette Avatar answered Sep 27 '22 18:09

MDrollette