PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 23, 2022

[FIXED] How to load mdbootstrap vue into Laravel 5 with laravel-mix?

 July 23, 2022     installation, laravel, mdbootstrap     No comments   

Issue

I am trying to install mdbootstrap vue into a Laravel 5.6 project, but i realy don't understand how i suppose to do it.

If somebody can give me a little tutorial, it would be nice of you ;-)


Solution

Try this(updated)...

(Assuming you have already installed laravel)

Go to your project directory and do:

npm install --save mdbvue

You will also need:

npm install --save-dev babel-preset-stage-2

next go to resources/js/bootstrap.js and under the require('bootstrap'); add require('mdbvue'); it should look something like this:

/**
 * We'll load jQuery and the Bootstrap jQuery plugin which provides support
 * for JavaScript based Bootstrap features such as modals and tabs. This
 * code may be modified to fit the specific needs of your application.
 */

try {
    window.$ = window.jQuery = require('jquery');

    require('bootstrap');
    require('mdbvue'); //<---this is what you need to add
} catch (e) {}

Next go to resources/sass/app.scss and add the MDB css under the bootstrap import, you might also need to import the font-awesome css:

// Material Design Bootstrap
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
@import '~bootstrap/scss/bootstrap';
@import "~mdbvue/build/css/mdb.css";

Now to compile your app.css and app.js files just do npm run dev

With this everything should be up and running and you are free to use MDBvue components or simply use MDB jQuery version.

This worked for me on a Laravel 5.7 project. Hope this helps.



Answered By - natral
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing