laminas / laminas-mvc-skeleton

Skeleton application for creating laminas-mvc based projects.
https://docs.laminas.dev/mvc/
BSD 3-Clause "New" or "Revised" License
172 stars 66 forks source link

Updated Bootstrap to v5.3 using Bootstrap bundle #85

Open visto9259 opened 7 months ago

visto9259 commented 7 months ago
Q A
Documentation no
Bugfix no
BC Break no
New Feature yes
RFC no
QA no

Description

visto9259 commented 7 months ago

Ok. To my knowledge, there is no CDN that just points to Bootstrap. We will still need to specify the version. If the objective is to prevent updating the skeleton when Bootstrap is updated, then we are not in a better position.

If the objective is to not keep local copies of Bootstrap, then CDN is better.

I will wait for @froschdesign and @Xerkus to comment on this before I make the change to use CDN.

froschdesign commented 7 months ago

The usage from the CDN is good idea because:

But I have an even more radical suggestion: stop using Bootstrap! The benefits would be:

For example, we could use Pico CSS.

visto9259 commented 7 months ago

I already updated the PR to use the CDN.

As far as using Bootstrap or not, I do not believe it is my decision to make since I do not "own" the skeleton.

When I started to use the Zend Framework 3 about 8 or 9 years ago, the skeleton was useful to get me going as I was starting from pretty much nothing in terms of web application. Even Bootstrap was unknown to me (CSS was mysterious concept to me). The fact that it was using Bootstrap got me started with frontend toolkits. Bootstrap is a widely used toolkit. Whether it's good, bad, etc. is a matter of taste. The Getting Started tutorial was also very instructive, even the part on formatting form elements.

If the objective is to get someone going with Laminas MVC, when they already are familiar with HTML/CSS concepts and already have a preferred toolkit, then it should be minimalist in terms of CSS. If the objectve also includes to get going with web development in general (like I was at that time), then using Bootstrap is a good starting point.

The part of the tutorial on updating the class in form elements may seem complicated but one has to know this to render views with the desired look, regardless of the UI toolkit used. It was useful to me when I started.

froschdesign commented 7 months ago

I already updated the PR to use the CDN.

I have already seen this.

As far as using Bootstrap or not, I do not believe it is my decision to make since I do not "own" the skeleton.

Nobody has asked you to do this. 😄

The Getting Started tutorial was also very instructive, even the part on formatting form elements.

I'm not saying that Bootstrap is bad or that formatting forms isn't important, but this stuff doesn't belong in a getting started tutorial. It is an introduction and also a kind of advertisement for how good and easy it is to use. And that's a horror for a first start, and I don't even want to think about advertising:

<?php
// module/Album/view/album/album/edit.phtml:

$title = 'Edit album';
$this->headTitle($title);
?>
<h1><?= $this->escapeHtml($title) ?></h1>
<?php
$album = $form->get('title');
$album->setAttribute('class', 'form-control');
$album->setAttribute('placeholder', 'Album title');

$artist = $form->get('artist');
$artist->setAttribute('class', 'form-control');
$artist->setAttribute('placeholder', 'Artist');

$submit = $form->get('submit');
$submit->setAttribute('class', 'btn btn-primary');

$form->setAttribute('action', $this->url('album', [
    'action' => 'edit',
    'id'     => $id,
]));
$form->prepare();

echo $this->form()->openTag($form);
?>
<div class="form-group">
    <?= $this->formLabel($album) ?>
    <?= $this->formElement($album) ?>
    <?= $this->formElementErrors()->render($album, ['class' => 'help-block']) ?>
</div>

<div class="form-group">
    <?= $this->formLabel($artist) ?>
    <?= $this->formElement($artist) ?>
    <?= $this->formElementErrors()->render($artist, ['class' => 'help-block']) ?>
</div>

<?php
echo $this->formSubmit($submit);
echo $this->formHidden($form->get('id'));
echo $this->form()->closeTag();

Much better:

<?php
// module/Album/view/album/album/edit.phtml:

$title = 'Edit album';
$this->headTitle($title);
?>
<h1><?= $this->escapeHtml($title) ?></h1>

<?= $this->form($form) ?>

Of course, the links to further explanations must then be added, as we have already done in other tutorials, for example:

And with a cookbook recipe I mean something like this: https://docs.laminas.dev/laminas-mvc-plugin-flashmessenger/cookbook/bootstrap/

visto9259 commented 4 months ago

@gsteel @froschdesign Where do we stand on this PR? I understand that there is no further changes requested or am I missing something? So that we can close issue #84

Xerkus commented 4 months ago

I am against using CDN in a skeleton. Especially after polyfill cdn supply chain attack.