yiisoft / yii2-bootstrap4

Yii 2 Bootstrap 4 Extension
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
216 stars 106 forks source link

Incorrect $sourcePath in BootstrapAsset.php #170

Closed p2made closed 5 years ago

p2made commented 5 years ago

My first go at a projet using bootstrap 4 is failling with...

Invalid Argument – yii\base\InvalidArgumentException

The file or directory to be published does not exist: /path/to/vendor/npm/bootstrap/dist

The following trace points to yiisoft/yii2-bootstrap4/src/Nav.php which loads yiisoft/yii2-bootstrap4/src/BootstrapAsset.php which has...

class BootstrapAsset extends AssetBundle
{
    public $sourcePath = '@npm/bootstrap/dist';
    public $css = [
        'css/bootstrap.css',
    ];
}

However the NPM package is installed at vendor/npm-asset which is in keeping with yiisoft/yii2-bootstrap4/composer.json which has...

    "require": {
        "yiisoft/yii2": "~2.0",
        "npm-asset/bootstrap": "^4.3"
    },

Shouldn't that $sourcePath be @npm-asset/bootstrap/dist?

YiiRocks commented 5 years ago

No, because https://www.yiiframework.com/doc/guide/2.0/en/concept-aliases#predefined-aliases

Set correct path like this.