简体   繁体   中英

how to use bootstrap with Laravel 5.2

I need use bootstrap 3 with My Laravel app. I have download bootstarp and paste it Laravel public-css folder. now I need integrate its with My Laravel app. how can I do this? I do not use bootstrap theme. only css and js files. I need exit cdn.

Laravel 5.2 comes with bootstrap sass in place. You can find it under the resources directory:

https://github.com/laravel/laravel/blob/5.2/resources/assets/sass/app.scss

Just uncomment the @import line and build the public resources with gulp or something. To include the javascript just include it in your document head like you would any other resource.

<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>

I found an solution try this one

download the bootstrap package and

    copy bootstrap.min.css into your public/css folder
    copy bootstrap.min.js into your public/js folder

Add the following to the head area of app.blade.php

<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">

Before the closing in app.blade.php add

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<script src="{{ asset('js/bootstrap.min.js') }}"></script>

after past myapp/public/css/bootstrap.min.css file

you have to import css boostrap sourse,

<link rel="stylesheet" href="<?php echo asset ('css/bootstrap.min.css')?>" type="text/css">

Bootstrap is already included with Laravel. On Laravel 5.8 it is under public/css/app.css location 在此输入图像描述

you just need to add the file to the blade template to use bootstrap like this

  **<link href="{{ asset('css/app.css') }}" rel="stylesheet">**

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM