Guilherme Gomes
Guilherme Gomes

Reputation: 1

Import Bootstrap 4 into Laravel 6

I'm a Laravel newbie, and I was trying to import Bootstrap 4 automatically with npm install and npm run dev (after setting Bootstrap with its proper version into package.json) just as I saw in some Laravel classes I'm watching.

The problem is that after I use both commands, app.css is empty. Here's what I did this far.

  1. composer create-project --prefer-dist "laravel/laravel" cadastro

  2. Configuring package.json ("bootstrap": "^4.3.1")

  3. npm install

  4. npm run dev

Is there something wrong with my steps? My Laravel version is 6.5.2.

Upvotes: 0

Views: 4322

Answers (1)

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111839

You should run

composer require laravel/ui --dev
php artisan ui bootstrap

commands in your console to have some initial JS file with Bootstrap setup. Otherwise if resources/js/app.js file is empty, importing like this won't be enough.

You should read documentation about this.

Upvotes: 2

Related Questions