E
E
edik892016-07-12 11:32:28
Yii
edik89, 2016-07-12 11:32:28

How to update bower package in yii2?

I know that yii2 uses the fxp/composer-asset-plugin plugin, which allows you to manage bower packages through composer, but I can't figure out how to use it. In the composer.json file, I see the construction:

"asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }

The vendor/bower folder contains the packages I need. I don't quite understand how I can add a new package or update an existing one. For example, there is a nivo-lightbox package in the vendor/bower folder that I want to update. The nivo-lightbox folder itself contains only the sources themselves, the bower.json file is missing. The question is: how do I specify the required version for a package and only update it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korovin, 2016-07-13
@edik89

In fact, everything is quite simple. See:
1. Go here and find the right package.
2. Let's say we need font awesome:
3. Create an asset:

<?php
namespace backend\assets;

use yii\web\AssetBundle;

class FontAwesomeAsset extends AssetBundle
{
    public $sourcePath = '@bower/components-font-awesome';

    public $css = [
        'css/font-awesome.min.css',
    ];
}

4. PROFIT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question