Skip to content

Commit 06f4cc8

Browse files
authored
Merge pull request #11 from tattersoftware/bootstrap
Bootstrap
2 parents 022314a + 8a8183e commit 06f4cc8

6 files changed

Lines changed: 58 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ php spark publish
3434

3535
### Asset Libraries
3636

37+
* [Bootstrap](https://getbootstrap.com) - Mobile-first front-end CSS framework directed at responsive web development
3738
* [FontAwesome](https://fontawesome.com) - Popular icon set and toolkit for vector icons and social logos
3839
* [jQuery](https://jquery.com) - A fast, small, and feature-rich JavaScript library
3940

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"league/commonmark": "^1.5",
2929
"tatter/assets": "^3.0",
3030
"tatter/menus": "^1.0",
31-
"tatter/themes": "^2.0"
31+
"tatter/themes": "^2.0",
32+
"twbs/bootstrap": "^4.0"
3233
},
3334
"require-dev": {
3435
"codeigniter4/codeigniter4": "dev-develop",

src/Bundles/BootstrapBundle.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Tatter\Frontend\Bundles;
4+
5+
use Tatter\Frontend\FrontendBundle;
6+
7+
class BootstrapBundle extends FrontendBundle
8+
{
9+
public const VERSION = 4;
10+
11+
/**
12+
* Applies any initial inputs after the constructor.
13+
*/
14+
protected function define(): void
15+
{
16+
$this
17+
->addPath('bootstrap/css/bootstrap.min.css')
18+
->addPath('bootstrap/js/bootstrap.bundle.min.js')
19+
->merge(new JQueryBundle());
20+
}
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Tatter\Frontend\Publishers;
4+
5+
use Tatter\Frontend\FrontendPublisher;
6+
7+
class BootstrapPublisher extends FrontendPublisher
8+
{
9+
protected $source = 'vendor/twbs/bootstrap/dist';
10+
protected $path = 'bootstrap';
11+
}

tests/BundlesTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3+
namespace Tatter\Frontend\Bundles;
4+
35
use CodeIgniter\Publisher\Publisher;
4-
use Tatter\Frontend\Bundles\FontAwesomeBundle;
5-
use Tatter\Frontend\Bundles\JQueryBundle;
66
use Tatter\Frontend\FrontendBundle;
77
use Tests\Support\TestCase;
88

@@ -56,6 +56,16 @@ public function testBundlesFiles(string $class, array $expectedHeadFiles, array
5656
public function bundleProvider()
5757
{
5858
return [
59+
[
60+
BootstrapBundle::class,
61+
[
62+
'bootstrap.min.css',
63+
'jquery.min.js',
64+
],
65+
[
66+
'bootstrap.bundle.min.js',
67+
],
68+
],
5969
[
6070
FontAwesomeBundle::class,
6171
[

tests/PublishersTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3+
namespace Tatter\Frontend\Publishers;
4+
35
use Tatter\Frontend\FrontendPublisher;
4-
use Tatter\Frontend\Publishers\FontAwesomePublisher;
5-
use Tatter\Frontend\Publishers\JQueryPublisher;
66
use Tests\Support\TestCase;
77

88
/**
@@ -36,6 +36,15 @@ public function testPublishesFiles(string $class, array $expected): void
3636
public function publisherProvider()
3737
{
3838
return [
39+
[
40+
BootstrapPublisher::class,
41+
[
42+
'bootstrap/css/bootstrap.css',
43+
'bootstrap/css/bootstrap.min.css.map',
44+
'bootstrap/js/bootstrap.bundle.js',
45+
'bootstrap/js/bootstrap.min.js.map',
46+
],
47+
],
3948
[
4049
FontAwesomePublisher::class,
4150
[

0 commit comments

Comments
 (0)