Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it a good idea to hook up composer to manage web assets in symfony2?

As you know, in Symfony2.1 php bundles and packages are managed by composer, but would be maybe a good idea to hook up the managing of web assets as well? I would really love to update Twitter Bootstrap, jQuery, jQueryUi, Underscore.js and many other libraries using the same console command i use to update the php packages.

Are there any serious downsides of doing this?

like image 788
Vlad Avatar asked Sep 16 '12 17:09

Vlad


1 Answers

Well, it sounds like a great idea, but I don't think it would be possible:

  1. Composer is created for handling PHP dependencies, not for handling front-end dependencies, the twitter team has created Bower for front-end dependencies.
  2. Combining those 2 great libraries is a huge task: You will need to create your own composer commands and configuration files.
  3. Bower puts everything in a components directory. This isn't the correct dir for web assets, you will need to change this. You can't change this in the Bower config, as far as I know about Bower, which is almost equal to zero. UPDATE As said by @xanido, you can configure the output directory with the directory option as of Bower 0.3.0.

So well, you can manage web assets in Symfony2, with Bower (and maybe other programs like that), but combining those 2 isn't a good practise. Use Bower and Composer seperately can be useful, although you get another web assets directory.

like image 90
Wouter J Avatar answered Sep 28 '22 12:09

Wouter J