📜  laravel bootstrap ui - PHP (1)

📅  最后修改于: 2023-12-03 15:17:12.192000             🧑  作者: Mango

Laravel Bootstrap UI

Laravel Bootstrap UI is a package that provides a scaffolding for Laravel projects with the Bootstrap CSS framework.

Installation

The package can be installed via Composer:

composer require laravel/ui

Then, you need to install the preset:

php artisan ui bootstrap

The package will install the necessary frontend dependencies, like Bootstrap and jQuery. You can also choose to install Bootstrap with Sass instead of plain CSS:

php artisan ui bootstrap --sass
Usage

Laravel Bootstrap UI provides several commands to generate the views and assets for Bootstrap. The most common commands are:

php artisan ui bootstrap --auth  # Generate authentication views with Bootstrap
php artisan ui bootstrap --views  # Generate only the views for Bootstrap
php artisan ui bootstrap --preset=foo  # Generate with a specific preset (default is 'bootstrap' or 'bootstrap-sass')
Customization

You can customize the scaffolding generated by Laravel Bootstrap UI by editing the templates in the resources/views/vendor/bootstrap directory. You can also publish the templates so they can be easily edited outside of the package:

php artisan vendor:publish --tag=laravel-bootstrap-ui-views

If you want to customize the CSS of Bootstrap, you can create a resources/sass/bootstrap.scss file and import it in your app.scss file:

// resources/sass/bootstrap.scss

@import '~bootstrap/scss/bootstrap';
// Your custom styles here
// resources/sass/app.scss

@import 'bootstrap';

Then, you can compile the sass files with:

npm run dev
Conclusion

Laravel Bootstrap UI is a great package to quickly scaffold a Laravel project with Bootstrap CSS. It provides easy customization options and allows for a fast start on a new project.