Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Same as title, i don't want using bootstrap.css and bootstrap.js. I try using:

'assetManager' => [
    'bundles' => [
        'yiiootstrapBootstrapAsset' => [
            'css' => [],
        ],
    ],
],

It remove bootstrap.css but can't remove bootstrap.js. Somebody can help me?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
320 views
Welcome To Ask or Share your Answers For Others

1 Answer

In web.php config file add the following code into components array:

'assetManager' => [
        'bundles' => [
            'yiiootstrapBootstrapPluginAsset' => [
                'js'=>[]
            ],
        ],
    ],

To be more comprehensive:

in order to disable Css (bootstrap.css):

'assetManager' => [
    'bundles' => [
        'yiiootstrapBootstrapAsset' => [
            'css' => [],
        ],
    ],
],

in order to disable JS (bootstrap.js):

'assetManager' => [
    'bundles' => [
        'yiiootstrapBootstrapPluginAsset' => [
            'js'=>[]
        ],
    ],
],

in order to disable JQuery (jquery.js)

'assetManager' => [
    'bundles' => [
        'yiiwebJqueryAsset' => [
            'js'=>[]
        ],
    ],
],

In order to have all of them disabled:

'assetManager' => [
    'bundles' => [
        'yiiwebJqueryAsset' => [
            'js'=>[]
        ],
        'yiiootstrapBootstrapPluginAsset' => [
            'js'=>[]
        ],
        'yiiootstrapBootstrapAsset' => [
            'css' => [],
        ],

    ],
],

UPDATE

As Soju mentioned in comments, another alternative way would be disabling these files in AppAsset class, which is located in ./assets/, then remove the following lines:

public $depends = [
   'yiiwebYiiAsset',              #REMOVE
   'yiiootstrapBootstrapAsset',  #REMOVE
];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...