zen_1991
zen_1991

Reputation: 629

Installing Bootstrap 4 in a fresh Laravel installation

How would you get Bootstrap 4 Beta running in a fresh Laravel 5.5 installation? I need to be able to version the style sheets and javascript but i can't seem to get it working.

Upvotes: 1

Views: 1883

Answers (1)

zen_1991
zen_1991

Reputation: 629

I figured it out! The process doesn't seem to be well documented so i decided to post it here in case any one else battles with the process!

Once you have created a new project, navigate to your package.json file and remove bootstrap-sass. Once you have done this, delete your node_modules folder.

1) In your terminal run npm install [email protected] --save

2) In your terminal run npm install popper.js --save

3) If needed run npm install to install any other node modules.

4) Navigate to resources/assets/js/bootstrap.js file and make the following changes:

try {
  window.$ = window.jQuery = require('jquery');
  window.Popper = require('popper.js').default;

  require('bootstrap');
} catch (e) {}

5) Open your webpack.mix.js file and add the following:

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css')
   .version();
mix.browserSync('bootstrap.dev');

6) Now if you run npm run watch if you have done everything correctly, your Laravel 5.5 project should now be running with Bootstrap 4 Beta!

Upvotes: 4

Related Questions