How to remove Bootstrap correctly from Laravel 5.4?
Asked Answered
J

4

5

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?

Judgeship answered 13/2, 2017 at 22:28 Comment(1)
What exactly was your edit(s) and what were you trying to achieve?Landside
C
13

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
Caudal answered 13/9, 2018 at 8:1 Comment(0)
A
10

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
Abad answered 13/2, 2017 at 23:33 Comment(0)
M
1

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.

Methadone answered 8/8, 2019 at 1:58 Comment(0)
P
0

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';
Pickaninny answered 24/8, 2020 at 11:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.