Bower Assets in Composer

I am still learning composer and Yii2 and I am hitting a bump here.

I am trying to add Modernizr into the asset bundle.

Following the first step in guide, which says:

  1. Modify the composer.json file of your application or extension and list the package in the require entry. You should use bower-asset/PackageName (for Bower packages) or npm-asset/PackageName (for NPM packages) to refer to the library.

I added the following lines into composer.json:




"require": {

        //.......

        "bower-asset/modernizr": "*"

    },



However, upon running composer update, it cannot find the bower package. Do I need to configure anything else?

Thanks.

I’m not sure if this is the issue, but have you run:

php composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta3" (Yii 2.0.0)

or

php composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta4" (Yii 2.0.1)

this needs to be run once on your machine. It has something to do with managing bower assets - I must admit I’m not entirely clear what.

Thanks cshehdl, that works!