2

Say I have my project set up like so:

/my-app
    bower.json
    /bower_components
    /vendor
        /package1
            bower.json
        /package2
            bower.json

Is it possible for me to configure bower (via .bowerrc, grunt or otherwise) to look at all the bower.json files and install all dependencies into /my-app/bower_components.

In other words can bower merge /my-app/bower.json, /my-app/vendor/package1/bower.json and /my-app/vendor/package2/bower.json.

If this is possible, is it possible to do automatically, i.e not have to provide specific paths to the package's bower.json files.

HelloPablo
  • 615
  • 1
  • 7
  • 22
  • I did this way:http://stackoverflow.com/questions/30399841/merging-two-bower-json-files-with-similar-attributes-merging-two-json-files-wit?noredirect=1#comment48887545_30399841 – mohi May 24 '15 at 15:07

1 Answers1

1

I'm looking for a solution too; at the moment I have this simple shell script:

find packages plugins ! -path "packages/*/bower_components/*" ! -path "plugins/*/bower_components/*" -type f -name "bower.json" | while read file; do
  printf "Processing file '$file'\n"
  cd ./$(dirname $file)
  bower update
  cd -
done

It iterates through bower.json files located in ./packages and ./plugins and executes them. After that you have a bower_components folder for each package or plugin found. You need a second script (or build tool like Grunt or Gulp) to copy all assets from the packages/plugins to your public root assets folder.

halfer
  • 19,824
  • 17
  • 99
  • 186
Kevin
  • 1,232
  • 10
  • 28
  • Yeah, seems like a sensible approach - I can't imagine it handles dependencies though, right? i.e if two separate bower.json request conflicting versions etc. – HelloPablo Jun 02 '15 at 13:43