Home > OS >  Laravel 8 Bootstrap Doesn't Read bootstrap
Laravel 8 Bootstrap Doesn't Read bootstrap

Time:10-06

I installed bootstrap in Laravel 8 using the ff commands:

npm install --save bootstrap jquery @popperjs/core cross-env

Inside app/resources/js/bootstrap.js included the ff stabs:

try {
    window.Popper = require('popper.js').default;
    window.$ = window.jQuery = require('jquery');

    require('bootstrap');
} catch (e) {}

Then inside app/resources/scss/app.scss I included bootstrap:

// bootstrap
@import "~bootstrap/scss/bootstrap";

Finally, on my webpack.mix.js:

mix.js("resources/js/app.js", "public/js").sass(
    "resources/scss/app.scss",
    "public/css"
);

Upon using a view to test if bootstrap is working, I included it like this:

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

<button type="button" class="btn btn-primary">Primary</button>

This however did not work and bootstrap did not load. Any idea how to properly load bootstrap so I can use each codes?

CodePudding user response:

Try this and check update files in public/js and public/css:

npm install && npm run dev
  • Related