Disable Config Component on Specific Action?

Hi all,

I have the assetsAutoCompress component in my web config file:


$config = [

    ...

    'bootstrap' => [

        ...

        'assetsAutoCompress'

    ],

    'components' => [

        'assetsAutoCompress' => [

            'class' => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent'

        ],

        ...

    ],

];

Which is working great for me, except on one page that makes use of JWPlayer. On this page, the Javascript compressing causes some sort of parse error (the logged error is an invalid regex, but was presumably cascaded down from something several levels up that didn’t quite gel with the compression - and it’s a foreign script so I can’t even debug it myself).

So: can I disable parts of the config for one specific action? I’m trying to DISable on the one offending page, rather than ENable it on every single other page, now or in the future.

Thanks!

An ugly way is to unset the component from the array inside index.php by checking the uri of the website. A nice way is to use the event ‘on beforeAction’ attached to the configuration where you may initialize the object of AssetsAutoCompressComponent depending on an action. The 3rd way is to use ‘bootstrap’ key which is accessable through the main configuration assignig to the key the class which will initialize the component on the rules you need.

Thanks for the reply - I wound up actually rewriting the extension itself to support ‘skipping’ specific files xD Probably the least efficient route I could have gone judging by what your reply!