Tatter\Bootstrap
Integration of the popular Bootstrap CSS framework for CodeIgniter 4
Description
This library leverages Tatter\Assets to automate asset discovery and HTML tag injection for the popular Bootstrap CSS framework. Be sure to read the documentation for Tatter\Assets
on how to integrate the filter with your application's routes.
Note: While this library may be used by itself the author's intent is to include it with Tatter\Frontend to provide an opinionated suite of frontend utilities.
Installation
Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:
> composer require tatter/bootstrap
Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php
.
Once the files are downloaded and included in the autoload run the framework's publish
command to inject all assets into your front controller path:
> php spark publish
Note: This package includes support for Bootstrap 4 or 5. Composer will default to the latest available so if your project requires version 4 then specify so in composer.json.
Configuration
For full configuration details see the Assets docs.
Enable the AssetsFilters
on any "after" routes where you want tags applied. To apply them everywhere simply add to $globals
. app/Config/Filters.php:
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array
*/
public $globals = [
'before' => [
// 'honeypot',
// 'csrf',
],
'after' => [
'assets',
],
];
Then create or edit your Assets
config file and add the bundle. app/Config/Assets.php:
<?php
namespace Config;
class Assets extends \Tatter\Assets\Config\Assets
{
public $routes = [
'*' => [
\Tatter\Bootstrap\Bundles\BootstrapBundle::class,
],
];
}