Chris J. Lee

Dallas Drupal Developer

You are here

Bower Pre-Post install Hooks

With the advent of Bower >=v1.3.1 it includes hooks.

I was trying to use bower pre and post install to integrate a couple things with grunt: added assets as they are installed, browsify ech file, etc.

Was trying to figure out the rational and understand how bower these install hooks works. It's not totally clear.

There is a Markdown file that discusses pre and post-install hooks for bower:

Bower provides 3 separate hooks that can be used to trigger other automated tools during Bower usage. Importantly, these hooks are intended to allow external tools to help wire up the newly installed components into the parent project and other similar tasks. These hooks are not intended to provide a post-installation build step for component authors. As such, the configuration for these hooks is provided in the .bowerrc file in the parent project's directory.

I needed to dig deeper. So I found the genesis of this particular feaure on a github issue. Looks as they are discussing the issues and gaps that currently exist with bower. A lot of those i've been struggling to figure out an elegant solution.

Bower's current gaps in browser asset delivery

Because of how bower works. There are some issues with it currently:

  • Some libraries don't have a built JavaScript version in the Github repository. This requires the consumer to write tasks to build these particular libraries.
  • Often people reference the bower_component folder to deliver their application. This can be combersome if the author of that file decides to rename them or move them. Then your references become fragile and not change tolerant.

More on this

Tags: 
bower
© 2017 Chris J. Lee