N
N
Nik Gubin2017-02-12 02:29:35
Yii
Nik Gubin, 2017-02-12 02:29:35

How to disable Asset in Yii2?

Goodnight. I'm learning Yii2, don't hit me with your slippers.
I know how to disable assets, through the configuration, BUT: two directories are still created in the web/assets directory, jquery is located in the first, and bootstrap in the second. This is not critical, of course, but I want to understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-02-12
@gubin_niko

Goodnight.
In order not to create directories in web/assets in the configuration file, write in the components section

'assetManager' => [
  'linkAssets' => true 
]

Directories will not be created, but links to files will be created. This is useful when developing, css, js and other resources will be updated every time the page is reloaded.
If you want to completely disable, write like this
'assetManager' => [
            'bundles' => [
                'yii\web\JqueryAsset' => [
                    'js'=>[]
                ],
                'yii\bootstrap\BootstrapPluginAsset' => [
                    'js'=>[]
                ],
                'yii\bootstrap\BootstrapAsset' => [
                    'css' => [],
                ],
            ],
        ],

Will disable both jquery and bootstrap.
But I would not advise you to do this, yii2 connects the necessary jquery, js scripts, without them it will not work very well with yii2.
You can also play around with the settings in AppAsset. It is located at the root of the application in the assets directory.
More about this file and connecting different css, js here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question