{"id":6494,"date":"2019-09-13T08:46:24","date_gmt":"2019-09-13T08:46:24","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=6494"},"modified":"2021-11-16T10:14:03","modified_gmt":"2021-11-16T10:14:03","slug":"how-to-configure-laravel-5-5-with-bootstrap-4","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-configure-laravel-5-5-with-bootstrap-4\/","title":{"rendered":"How to configure Laravel 5.5 with Bootstrap 4"},"content":{"rendered":"\n<div style=\"border-left: 4px solid #4199d3;background-color: #e4f3d5;padding: 12px\">\n<h4 style=\"border: 1px solid #7ebdf8;padding: 4px\">Bootstrap 3 to bootstrap 4.3.1 upgrade in Laravel 5.5<\/h4>\n<span style=\"background-color: #e7f3fe;border-left: 4px solid #2196F3;padding: 4px\">Note: Laravel 5.5 uses bootstrap 3 by default<\/span>\n<\/div>\n<div style=\"border-left: 4px solid #4199d3;background-color: #e4f3d5;padding: 12px\">\n<h5 style=\"text-decoration: underline\">Steps involved in the upgrade<\/h5>\n<ol><li>Open gitbash in the home directory of the Laravel application and run the command given below:\n<pre><code>npm install bootstrap@4.3.1<\/code><\/pre>\n<\/li>\n<li>Change needed in resources\\assets\\sass\\app.scss file:\n<br>\n<i>\/\/ Remove this line <\/i>\n<strike><pre><code>@import \"~bootstrap-sass\/assets\/stylesheets\/bootstrap\";<\/code><\/pre><\/strike>\n<i>\/\/ Add this line <\/i>\n<pre><code>@import \"node_modules\/bootstrap\/scss\/bootstrap\";<\/code><\/pre>\n<\/li>\n<li>Change needed in  file resources\\assets\\sass\\_variables.scss\n<br>\n<i>\/\/ Remove this line from _variable.scss as &#8220;px&#8221; is not supported by bootstrap4.x.y <\/i>\n<strike><pre><code>$font-size-base: 14px;<\/code><\/pre><\/strike>\n<i>\/\/ Add this line. This will work for bootstrap4.x.y <\/i>\n<pre><code>$font-size-base: 0.875rem;<\/code><\/pre>\n<\/li>\n<li>Change needed in file resources\\assets\\js\\bootstrap.js\n<br>\n<i>\/\/ Remove this line <\/i>\n<strike><pre><code>require('bootstrap-sass');<\/code><\/pre><\/strike>\n<i>\/\/ Add this line for using bootstrap 4.3.1<\/i>\n<pre><code>require('bootstrap');<\/code><\/pre>\n<\/li>\n<li>Open gitbash in you project directory then run\n<br>\n<i>\/\/ Run following command <\/i>\n<pre><code>npm run dev<\/code><\/pre><br>\n<span style=\"background-color: #e7f3fe;border-left: 4px solid #2196F3;padding: 4px\">Note: npm run dev compiles all the css and js files from resources\\assets to public dir<\/span>\n<\/li>\n<\/ol>\n<\/div>\n<br>\n<div style=\"border-left: 4px solid #ffb900;background-color: #e4f3d5;padding: 12px\">\n<h4 style=\"border: 1px solid #7ebdf8;padding: 4px\">How to check if bootstrap 4.3.1 was successfully compiled?<\/h4>\n<p>Open app.css from public\/css and check the bootstrap version mentioned in the top comments section. It must show something as shown below<\/p>\n<pre><code>@import url(https:\/\/fonts.googleapis.com\/css?family=Raleway:300,400,600);\/*!\n * Bootstrap v4.3.1 (https:\/\/getbootstrap.com\/)\n * Copyright 2011-2019 The Bootstrap Authors\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https:\/\/github.com\/twbs\/bootstrap\/blob\/master\/LICENSE)\n *\/<\/code><\/pre><br>\n<\/div>\n<br>\n<div style=\"border-left: 4px solid #4199d3;background-color: #e4f3d5;padding: 12px\">\n<h4 style=\"border: 1px solid #7ebdf8;padding: 4px\">How to use bootstrap 4.3.1 in your html or blade files?<\/h4>\n<p>Import app.css from public\/css directory in blade or html file (s) using below code<\/p>\n<pre><code>&lt;link rel=\"stylesheet\" href=\"{{asset('css\/app.css')}}\"&gt;<\/code><\/pre><br>\n<\/div>\n<br>\n<div style=\"border-left: 4px solid #ffb900;background-color: #e4f3d5;padding: 12px\">\n<h4 style=\"border: 1px solid #7ebdf8;padding: 4px\">Do we need to do anything else? <\/h4>\n<p>If you have used any class that&#8217;s not supported by bootstrap 4\nthen you need to make changes accordingly by going through the official documentation of bootstrap 4<\/p>\n<\/div>\n<br>\n<div style=\"border-left: 4px solid #4199d3;background-color: #e4f3d5;padding: 12px\">\n<h4 style=\"border: 1px solid #7ebdf8;padding: 4px\">Possible Errors!<\/h4>\n<img decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2019\/09\/bootstrap4-upgrade-error.png\">\n<div style=\"background-color: #e7f3fe;border-left: 4px solid #2196F3;padding: 4px\"><h6 style=\"text-decoration: underline\">Solve it by running following commands!<\/h6>\n<pre><code>npm install --save popper.js\nnpm run dev<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_69519\"><iframe loading=\"lazy\"  id=\"_ytid_41525\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_69519\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Bootstrap 3 to bootstrap 4.3.1 upgrade in Laravel 5.5 Note: Laravel 5.5 uses bootstrap 3 by default Steps involved in the upgrade Open gitbash in the home directory of the&#8230; <\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5201],"tags":[],"class_list":["post-6494","post","type-post","status-publish","format-standard","hentry","category-laravel"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/6494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=6494"}],"version-history":[{"count":21,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/6494\/revisions"}],"predecessor-version":[{"id":25444,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/6494\/revisions\/25444"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=6494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=6494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=6494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}