simple
simple

Reputation: 2397

Bower.json install only single file

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"
      }
  }
}

Upvotes: 1

Views: 3854

Answers (4)

robstarbuck
robstarbuck

Reputation: 8091

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"
}

Upvotes: 7

Paul Lynch
Paul Lynch

Reputation: 1337

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"
    ]
  }
}

Upvotes: 2

Rodrigo
Rodrigo

Reputation: 1688

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

Upvotes: 0

Leeft
Leeft

Reputation: 3837

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.

Upvotes: 7

Related Questions