wiki:members/GRIP-UQAM/Bower

Javascript packages: Bower

Usage of Bower for PHP applications obsoleted

Better use https://packagist.org/packages/fxp/composer-asset-plugin

From npm to bower

  • $ nice -n 127 ionice --class=idle npm install bower --save
  • $ nice -n 127 ionice --class=idle npm update #update!
  • or (like there is something to check here)
  • $ nice -n 127 ionice --class=idle npm update bower #update!
  • .bowerrc
  • $ nice -n 127 ionice --class=idle nodejs node_modules/bower/bin/bower init # to start a new empty bower.json
  • Install some libraries...
  • $ nice -n 127 ionice --class=idle nodejs node_modules/bower/bin/bower update --production #update!
  • bower could also be updated from php composer, using "fxp/composer-asset-plugin"

Obsoleted Example .bowerrc for Drupal 7

{
  "directory" : "../../web/sites/all/libraries"
}

Install Javascript libraries with Bower package manager

#$ nodejs node_modules/bower/bin/bower install --save "jquery#1.4.4" # Drupal 7 version
# or (good idea (checked))
nodejs node_modules/bower/bin/bower install --save jquery#~1.4.4 # Drupal 7 version
nodejs node_modules/bower/bin/bower install --save jquery-colorbox # depends on jquery
nodejs node_modules/bower/bin/bower install --save ckeditor#full/stable
  • $ ls bower_components/
  • or
  • $ ls ../../web/sites/all/libraries

Obsoleted Example bower.json for Drupal 7

{
  "name": "drupal7",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "../../web/sites/all/libraries",
    "test",
    "tests"
  ],
  "dependencies": {
    "jquery": "~1.4.4",
    "jquery-colorbox": "^1.6.3",
    "ckeditor": "#full/stable"
  }
}
Last modified 2 years ago Last modified on Aug 22, 2016, 1:51:52 PM