Bower



Installer Bower dans un projet

Installer les depots requis
apt install npm nodejs-legacy
Installer Bower
# Installer Bower
npm install -g bower

# Mettre à jour Bower
npm i -g bower

# Créer le bower.json
bower init
Personnaliser l'installation

bower.json
{
  "name": "Proxidata",
  "version": "2.0.1",
  "description": "Proxidata est une application web de visualisation et d'achat de données B2B.",
  "author": "Bernie Anglade ",
  "homepage": "https://www.proxidata.fr/",
  "authors": [
    "bernie.anglade@laposte.net"
  ],
  "main": "",
  "moduleType": [],
  "license": "MIT",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "web/public/libs"
  ],
  "dependencies": {
    "jquery": ">=3.1.0",
    "jquery-tokenize": ">=2.5.1",
    "jquery-treetable": ">=3.2.0",
    "odometer": ">=0.4.7",
    "modernizr": ">=3.3.1",
    "nouislider": ">=8.5.1",
    "jstree": ">=3.3.2",
    "datatables.net": "~1.10.11"
  }
}
.bowerrc
{
  "directory": "app/components/",
  "timeout": 120000,
  "registry": {
    "search": [
      "http://localhost:8000",
      "https://bower.herokuapp.com"
    ]
  }
}
Gérer les librairies

Ajouter une librairie
# installs the project dependencies listed in bower.json
bower install

# A partir de son nom
bower install jquery --save

# A partir d'un repo git
bower install https://github.com/isagalaev/highlight.js.git --save

# GitHub shorthand
bower install desandro/masonry --save

# URL
bower install http://example.com/script.js --save
Mettre à jour les librairies
# En simple user
bower update

# En root
bower update --allow-root