0

How can I stop Yii2 from loading the pjax asset file automatically when I use the Pjax widget? I want to load it myself from a CDN. I've tried this:

        'assetManager' => [
            'bundles' => [
                'yii\web\PjaxAsset' => [
                    'js'=>[]
                ],
            ],
        ],

But that doesn't do anything. Any suggestions?

Littlebob
  • 155
  • 4
  • 15

2 Answers2

1

Use

'assetManager' => [
    'bundles' => [
        'yii\web\PjaxAsset' => [
            'sourcePath' => null,
            'js'=> ['//cdn.url.you/want/to/use']
        ],
    ],
],
Bizley
  • 17,392
  • 5
  • 49
  • 59
  • Unfortunately, that did not work either. I've also disabled Jquery and Bootstrap and those all disappear but the Pjax file is still there. – Littlebob Jun 09 '17 at 16:58
0

Alternative you could choose to disable specific asset bundle.

If you want to disable specific asset, use this:

'assetManager' => [
    'bundles' => [
        'yii\web\PjaxAsset' => false,
   ],
]

If you want to disable whole asset bundles, use this:

'assetManager' => [
    'bundles' => false,
]