Detailed introduction to sample code for introducing bootstrap. js in Yii2 Advanced Edition

Source: Internet
Author: User
This article describes how to introduce bootstrap. js in Yii2 advanced edition, which has some reference value. if you are interested, you can refer to it. This article describes how to introduce bootstrap. js in Yii2 advanced edition, which has some reference value. if you are interested, you can refer to it.

In frontend/assets/AppAsset. php

Sample code

Namespace frontend \ assets; use yii \ web \ AssetBundle;/*** Main frontend application asset bundle. */class AppAsset extends AssetBundle {public $ basePath = '@ webroot'; public $ baseUrl =' @ web'; public $ css = ['css/site.css ',]; public $ js = ['JS/main. JS',]; public $ depends = ['yii \ web \ yiiasset', 'yii \ bootstrap \ bootstrapasset ', // note that 'rmrevin \ yii \ fontawesome \ assetbundle' is required here,];}

In the file vendor/yiisoft/yii2-bootstrap/BootstrapAsset. php

Namespace yii \ bootstrap; use yii \ web \ AssetBundle;/*** Asset bundle for the Twitter bootstrap css files. ** @ since 2.0 */class BootstrapAsset extends AssetBundle {public $ sourcePath = '@ bower/bootstrap/dist'; public $ css = ['css/bootstrap.css',]; // the following code is added: public $ js = ['JS/bootstrap. JS',];}

OK

The above is a detailed description of the sample code introduced by bootstrap. js in Yii2 Advanced Edition. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.