Giregar
Giregar

Reputation: 192

How to remove Bootstrap correctly from Laravel 5.4?

I try to start a Laravel 5.4 project without Bootstrap.

After installing Laravel, I edited the following files:

resources/assets/js/app.js

require('./bootstrap');

package.json

...
"devDependencies": {
"axios": "^0.15.3",
"bootstrap-sass": "^3.3.7",
"jquery": "^3.1.1",
"laravel-mix": "^0.7.2",
"lodash": "^4.17.4",
"vue": "^2.1.10"
},
...

I've got the following error:

ERROR Failed to compile with 1 errors error in ./resources/assets/js/app.js

SyntaxError: /Users/.../package.json: Error while parsing JSON - Unexpected end of JSON input at JSON.parse () @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

Any suggestions?

Upvotes: 5

Views: 16749

Answers (4)

Frnak
Frnak

Reputation: 6812

The line

require('./bootstrap')

has nothing to do with the Bootstrap CSS library. It loads the bootstrap.js file, which you will find in your assets. This file serves the purpose of "bootstrapping" your application (front-end). If you want to remove the Bootstrap CSS library from your project you should:

  • remove it from package.json
  • remove dependencies within your app layout
  • remove loading of sources from app.js / bootstrap.js

Upvotes: 10

M Shafaei N
M Shafaei N

Reputation: 449

I also wanted to get rid of bootstrap css codes in my laravel project. I opened the file

  resources/sass/app.scss

and simply commented out the corresponding line as bellow

 // Bootstrap
 //@import '~bootstrap/scss/bootstrap';

Upvotes: 0

Derrick Graham
Derrick Graham

Reputation: 11

If you run "npm install" in the command line, bootstrap's sass files will be downloaded. Running "npm uninstall bootstrap-sass" afterwards will get rid of them.

Upvotes: 1

Dunsin Olubobokun
Dunsin Olubobokun

Reputation: 902

By default, Laravel 5.4 ships with Bootstrap and Vue.js scaffolding, but not everyone wants to use either of those technologies. With Laravel 5.5 you can run this if you don’t want any scaffolding to be generated out of the box by Laravel:

php artisan preset none

Upvotes: 13

Related Questions