Laravel-mix: Loading Bootstrap v4 with Bower and Laravel Mix

Created on 22 Feb 2017  路  2Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 0.8.1
  • Node Version (node -v): 7.3.0
  • NPM Version (npm -v): 3.10.10
  • OS: macOS Sierra 10.12.3

Description:

Let me just say upfront, I feel like this is totally a webpack-noob question.

What I want to do is use Bootstrap v4 instead of v3. I can install the latest Alpha release of Bootstrap v4 using bower, and including its SASS codebase into a Laravel Mix-based stack was trivial.

The part I don't know how to do is include the JavaScript stack. The statement for loading Bootstrap from the NPM module is

require('bootstrap-sass');

So I've commented that out, but I don't know how to do is load bower_components/bootstrap/dist/bootstrap.js using a require() statement. I suppose I could load jQuery and Bootstrap independently of my compiled app.js file, but that seems inefficient.

Thanks in advance for your help.

Most helpful comment

See! I knew I was ignorant. Thank you for being so kind in pointing out that I hadn't read the fucking manual. :) In a year of freelancing I've gone from using dumb-packaging with Grunt, to Webpack, to Gulp, back to Webpack to Laravel Mix, so my head is swimming a bit with the choices.

Is there a way I can support the work you are doing?

All 2 comments

Looks like there are instructions here: https://v4-alpha.getbootstrap.com/getting-started/download/#npm

I'd pull it all in through NPM, personally. So:

Install
npm install [email protected] --save
resources/assets/js/app.js
require('bootstrap');
resources/assets/sass/app.scss
@import '~bootstrap/dist/css/bootstrap.css';

See! I knew I was ignorant. Thank you for being so kind in pointing out that I hadn't read the fucking manual. :) In a year of freelancing I've gone from using dumb-packaging with Grunt, to Webpack, to Gulp, back to Webpack to Laravel Mix, so my head is swimming a bit with the choices.

Is there a way I can support the work you are doing?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dtheb picture dtheb  路  3Comments

Bomavi picture Bomavi  路  3Comments

stefensuhat picture stefensuhat  路  3Comments

kpilard picture kpilard  路  3Comments

Micaso picture Micaso  路  3Comments