How to remove Bootstrap correctly from Laravel 5.4?

14,347

Solution 1

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

Solution 2

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

Solution 3

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.

Share:
14,347
Giregar
Author by

Giregar

Updated on June 18, 2022

Comments

  • Giregar
    Giregar almost 2 years

    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?