javascriptlaravelbuttoniconsbootstrap-ui

Buttons don't have icons


My project is made on laravel+bootstrap. Buttons don't have icons and I don't know why.

My app.scss

// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');

// Variables
@import 'variables';

// Bootstrap
@import '~bootstrap/scss/bootstrap';
.table-buttons {
    text-align: right;
}
.table-buttons form {
    display: contents;
}

My blade with buttons

<td class="table-buttons">
    <a href="{{ route('application_form.show', $application_form) }}" class="btn btn-success">
        <i class="fa fa-eye"></i>
    </a>
    @if (!(Auth::user()->id == 2))
        <a href="{{ route('application_form.edit', $application_form) }}" class="btn btn-primary">
            <i class="fa fa-edit"></i>
        </a>
        <form method="POST" action="{{ route('application_form.destroy', $application_form) }}">
            @method('DELETE')
            @csrf
            <button type="submit" class="btn btn-danger">
                <i class="fa fa-trash-alt"></i>
            </button>
    @endif
    </form>
</td>

Of course, I used command npm run dev.

My links to icons in layout's blade:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="undefined" crossorigin="anonymous">

My error


Solution

  • With fontawsom v5 you have to get registered and insert a given script into DOM to load icons. enter link description here

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="undefined" crossorigin="anonymous">
    <script src="https://kit.fontawesome.com/ee826a2333.js" crossorigin="anonymous"></script>
    
    
    <button type="submit" class="btn btn-danger">
                <i class="fa fa-trash-alt"></i>
     </button>