1

I am a bower newbie. How can I download only a single file from GitHub instead of the entire set of files? I just want the latest fuelux.min.js file from this link and I want to put it in my plugins directory.

{
  "name": "my app",
  "version": "1.0",
  "dependencies": {
    "angular-local-storage": "latest",
    "fuelux":"latest"
    },
  "install" : {
    "path" : {
      "js": "plugins"
      }
  }
}
Alyona Yavorska
  • 569
  • 2
  • 14
  • 20
simple
  • 2,327
  • 7
  • 35
  • 55

4 Answers4

7

The idea of bower is that you include the entire published contents of the repository/package which is then installed by a developer through bower. You use your build system (grunt, broccoli, etc) to pick any files from that which need to be included in your own distribution.

If for some reason you really only want that single file you'll just have to include it in your application manually.

Leeft
  • 3,827
  • 1
  • 17
  • 25
  • You can download a [zip of the dist folder of the latest release](https://github.com/ExactTarget/fuelux/raw/master/dist/fuelux.zip) or use the [FuelCDN JS file](http://www.fuelcdn.com/fuelux/3.0.0/js/fuelux.min.js) which is hosted by Akamai. – Interactive Llama Aug 29 '14 at 12:59
  • @InteractiveLlama that's beyond the realm of Bower, which the question was about – Leeft Aug 29 '14 at 13:01
  • Yes. You said to include it in the application manually if the OP wanted a single file, so I was sharing how to include it in the application manually (which would be without using Bower). Maybe you meant include manually in the build process. – Interactive Llama Aug 30 '14 at 13:49
7

I agree with the answer provided by @Leeft. Should the circumstance arise when you do only need one file you can reference the Raw file listed on github in your install.

bower install https://raw.githubusercontent.com/chrishunt/retinajs/master/src/retina.js --save

This will include the dependency in your bower.json file

"dependencies": {
    "retina": "https://raw.githubusercontent.com/chrishunt/retinajs/master/src/retina.js"
}
robstarbuck
  • 6,893
  • 2
  • 41
  • 40
  • In case anyone's wondering what the circumstance was, I needed a specific version of retinajs and the retina.js was not included in repo's release https://github.com/chrishunt/retinajs/releases. – robstarbuck Jan 01 '17 at 23:30
  • I also needed ol3 dist, since I didn't wanted to build it myself, so I went down this road. – Mehraban Jan 29 '17 at 18:58
2

If you use wiredep with bower, you can add an overrides section to your package's bower.json, like:

"overrides": {
  "fuelux": {
    "main": [
      "dist/js/fuelux.min.js"
    ]
  }
}
Paul Lynch
  • 1,297
  • 13
  • 20
0

I agree with simple the one thing I don't enjoy about NPM and Bower is that they bloat the file-size on every project, sometimes when there's no need to.

Take a look at this NPM package that allows to install specific files and not the entire repo:

https://github.com/blittle/bower-installer

Community
  • 1
  • 1
Rodrigo
  • 1,638
  • 1
  • 15
  • 27