Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For Bower, set absolute path for directory setting in .bowerrc

Tags:

node.js

bower

I am trying to do this in my .bowerrc file

"directory": "~/bower_components"

which I want is to resolve to the current users home folder:

/home/me/bower_components

but currently it is being resolved to:

[currentDirectory]/~/bower_components

Is their a way to get it to point to an absolute path?

like image 908
Nikos Avatar asked Nov 25 '25 00:11

Nikos


1 Answers

The field you need to set in the .bowerrc is cwd to give your installs an absolute root.

For example, the .bowerrc file:

{
  'cwd': '/var/www/libraries',
  'directory': 'vendor'
}

will result in all your bower update/install commands to place packages in /var/www/libraries/vendor.

I experimented with using ~ for the cwd parameter, and Bower didn't understand it.

The documentation for what Bower expects to find in .bowerrc is in this Google doc.

like image 60
David Arceneaux Avatar answered Nov 26 '25 14:11

David Arceneaux