Integrate Bootstrap in Laravel 5.4

4

I'm starting with Laravel and I'm having trouble linking routes with Bootsrap

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    {{ HTML::style('assets/css/bootstrap.min.css', array('media' => 'screen')) }}
    <!-- <link href="{{ asset('assets/css/bootstrap.min.css')}}" rel="stylesheet"> -->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
@include('partials.navbar')
    <div class="container">
        @yield('content')
        <button type="button" class="btn btn-primary">Primary</button>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js">
    </script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src={{ url('/assets/js/bootstrap.min.js')}}></script>
</body>

And I can not get it linked, with the link it does not send me an error but it does not load the styles and with HTML::style send me:

  

Class 'HTML' not found

This is the structure of my project.

    
asked by M. Gress 30.03.2017 в 00:04
source

1 answer

3

To add the link to a resource within Public we usually use:

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

where the directory is:

  

Application / public / components / bootstrap / js / bootstrap.min.js

You can see the documentation on asset

EDIT

I see that in the image the bootstrap files (the web framework) are in the "bootstrap" folder of Laravel. The Bootstrap folder in the main Laravel directory is not for maintaining scripts or style sheets related to the client. This is a translation of the use of this directory:

  

The bootstrap Directory

     

The bootstrap directory contains files that initialize the framework and configure autoloading. This directory also contains the cache generated by the framework for performance optimization.

In Bootstrap directory, Laravel documentation

    
answered by 03.04.2017 / 18:48
source