Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you install a bower component from a subdirectory in a git repository?

I recognize that this may go against convention:

I am trying to install a bower component whose bower.json does not reside at the top level of the repository, so something to the effect of:

bower install https://github.com/myrepo/my-components/tree/master/my-specific-component

However bower responds with the following:

bower not-cached    https://github.com/my-repo/my-components/tree/master/my-specific-component#*
bower resolve       https://github.com/my-repo/my-components/tree/master/my-specific-component#*
bower download      https://github.com/my-repo/my-components/tree/master/my-specific-component
bower EHTTP         Status code of 404

How can I install a component from a subdirectory of a repository like this?

like image 913
David Smith Avatar asked Jan 13 '15 16:01

David Smith


2 Answers

If your git repository is public then bower installs from https://github.com/org/repo/archive/tag.tar.gz. If your git repository is private bower perform a git clone of the given url.

Since there is no url in git that can be used with git clone to clone a subdirectory of a repository nor url for downloading a tar of a subdirectory, bower cannot currently support installing from a subdirectory of a repository.

like image 165
sheenathejunglegirl Avatar answered Sep 21 '22 03:09

sheenathejunglegirl


I dont think you can do a bower install from a subfolder. I think the convention is that bower checks the root of git repository (depending on the commit you are asking) and then install component and dependency from there. If you have a look on core elements and paper elements hosted in git, you'll notice they are hosted in different repos

You might be able to use git submodule to include git inside another git repo so that you can reference the submodule when you want to install using bower (not tested though)

like image 33
Ahmadreza Avatar answered Sep 24 '22 03:09

Ahmadreza