Bootstrap 4 Laravel Preset for Laravel 5.5

Published on by

Bootstrap 4 Laravel Preset for Laravel 5.5 image

You can start using Bootstrap 4 beta with Laravel 5.5 with our new Bootstrap 4 frontend preset. The preset includes scaffolding for SCSS files, and imports Bootstrap 4 JavaScript plugins, jQuery, and Popper.js. As of this writing, we keep the jQuery dependency that ships with Laravel, but according to the Bootstrap documentation the jQuery slim version could be used instead.

The Bootstrap 4 preset resembles the current Bootstrap 3 scaffolding that ships with Laravel by default, with Bootstrap 4 variables and markup that give you a good starting point. When the final version of Bootstrap 4 is released, you will be able to update your project (relatively) smoothly.

How Does the Preset Work?

Laravel 5.5 ships with a preset command that gives you the ability to change frontend scaffolding or even delete it. Our package registers two presets, bootstrap4, and bootstrap4-auth, to provide you with more flexibility if you don’t want the auth views.

When you run the Bootstrap 4 preset command, it will remove the bootstrap-sass node module, and add bootstrap and popper.js node modules. Our preset bootstrap.js is the same as the default, except for a global Popper.js import, which is a new dependency for various Bootstrap 4 JavaScript plugins.

The app.scss file keeps the Raleway Google font, and imports an updated _variables.scss file that gives you a good starting point for your custom CSS.

// Fonts
@import url("https://fonts.googleapis.com/css?family=Raleway:300,400,600");
 
// Variables
@import "variables";
 
// Bootstrap
@import "~bootstrap/scss/bootstrap";

I’ve gone through the _variables.scss file and ported over some of the variables from the default Laravel version, and removed variables that are no longer relevant. For example, the panel component no longer exists in Bootstrap 4, and we’ve removed the associated variables. The variables file is a starting point that you can easily modify, and I’d recommend you learn more from Bootstrap’s theming documentation.

Installing the Bootstrap 4 Frontend Preset

With the new package auto-discovery installing the Laravel Bootstrap 4 preset couldn’t be simpler:

composer require laravelnews/laravel-twbs4
php artisan preset bootstrap4-auth
yarn && yarn dev

If you don’t need the auth views, you can install the preset like the following:

composer require laravelnews/laravel-twbs4
php artisan preset bootstrap4
yarn && yarn dev

Learn More

Check out our official repository to get started and if you notice any issues or something missing in our Bootstrap 4 preset, feel free to raise an issue or submit a pull request.

Bootstrap 4 is still a beta version (our preset uses Bootstrap 4 Beta 2), and a few breaking changes will be coming to Beta 3. After Beta 3 is released, the next release is the final release of Bootstrap 4!

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes.

Visit Larafast: Laravel SaaS Starter Kit
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
All Green logo

All Green

All Green is a SaaS test runner that can execute your whole Laravel test suite in mere seconds so that you don't get blocked – you get feedback almost instantly and you can deploy to production very quickly.

All Green
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with VILT and TALL stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
Asserting Exceptions in Laravel Tests image

Asserting Exceptions in Laravel Tests

Read article
Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4 image

Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4

Read article
Basset is an alternative way to load CSS & JS assets image

Basset is an alternative way to load CSS & JS assets

Read article
Integrate Laravel with Stripe Connect Using This Package image

Integrate Laravel with Stripe Connect Using This Package

Read article
The Random package generates cryptographically secure random values image

The Random package generates cryptographically secure random values

Read article
Automatic Blade Formatting on Save in PhpStorm image

Automatic Blade Formatting on Save in PhpStorm

Read article