Search code examples
javascriptbowerbower-install

How to place dependencies on a specific folder using bower?


I am using bower to import some libraries on my Project folder.

At the moment using bower install in cd Project, a folder www/lib is being installed in within my Project folder.

I need to get rid of www/lib and place all dependencies under Project folder.

How to achieve this

Project
      bower.json

I need this structure:

Project
      bower.json
      dojo
      dijit
      ...

{
    "name": "app",
    "version": "0.0.0",
    "dojoBuild": "app.profile.js",
    "dependencies": {
        "dojo": "~1.10.2",
        "dijit": "~1.10.2",
        "dojox": "~1.10.2",
        "normalize-css": "~3.0.0",
        "put-selector": "~0.3.6",
        "util": "dojo-util#~1.10.2",
        "xstyle": "~0.3.1"
    },
    "directory": "",
    "private": true
}

Solution

  • From the bower docs

    Bower can be configured using JSON in a .bowerrc file. For example:

    {
      "directory": "app/components/",  //set the directory you want here
      "analytics": false,
      "timeout": 120000,
      "registry": {
        "search": [
          "http://localhost:8000",
          "https://bower.herokuapp.com"
        ]
      }
    
    }
    

    directory

    String

    The path in which installed components should be saved. If not specified this defaults to bower_components.

    "directory": "~/my-project/vendor"