4

I have Asset file which is located in vendor/vova07/yii2-imperavi-widget/src/Asset.php and i want to override it, because i want to use changed redactor.min.jsfile which is located in web/js/redactor.min.js I tried to put this code to components in web.php :`

'assetManager' => [
    'bundles' => [
        'vova07\imperavi' => [
            'sourcePath' => 'vova07\imperavi\assets',
            'js' => ['redactor.min.js', '@app/web/js/redactor.min.js']
        ]
    ]
],

but it does not work

Vvk
  • 4,031
  • 29
  • 51
  • I think `@app` is not allowed here. You have to specify files that can be found relative to `sourcePath` directory. – robsch Feb 23 '16 at 07:46

2 Answers2

7

Have a try:

'assetManager' => [
    'bundles' => [
        'vova07\imperavi\Asset' => [
            'sourcePath' => null,
            'js' => [
                'js/redactor.min.js'
            ],
        ],
    ],
],

In section Customizing Asset Bundles:

You can configure multiple asset bundles similarly through yii\web\AssetManager::$bundles. The array keys should be the class names (without the leading backslash) of the asset bundles, ...

drodata
  • 517
  • 3
  • 11
0

I know this is old but i faced the same issue, @drodata almost had the solution. The web path and url must be set in orther to point to the web folder correctly:

    'assetManager' => [
        'bundles' => [
            'vova07\imperavi\Asset' => [
                'sourcePath' => null,
                'basePath' => '@webroot',
                'baseUrl' => '@web',
                'js' => [
                    'js/redactor.min.js'
                ],
            ],
        ],
    ],