Skip to content

Commit 20a7b92

Browse files
authored
Merge pull request #909 from roland04/bootstrap-5-migration
[docs] Move Bootstrap 5 migration to a new page
2 parents b6e39b3 + 0c11444 commit 20a7b92

File tree

2 files changed

+145
-100
lines changed

2 files changed

+145
-100
lines changed

docs/devupdate.md

+2-100
Original file line numberDiff line numberDiff line change
@@ -237,111 +237,13 @@ shortname,fullname,category,summary,cohort,student,cohort,teacher
237237

238238
</details>
239239

240-
## Bootstrap preparations for version 5
240+
## Refactoring BS4 features dropped in BS5
241241

242242
<Since version="4.4" issueNumber="MDL-71979" />
243243

244244
Some of the Bootstrap 4 classes will be deprecated or dropped in its version 5. To prepare for this, some of the current Bootstrap 4 classes usages have been replaced with version 5 compatible classes. This will help us to upgrade to Bootstrap 5 in the future.
245245

246-
### Badges
247-
248-
- Badge colour class helpers `.badge-*` have been replaced with background utilities (use `.bg-primary` instead of `.badge-primary`) combined with the corresponding text colour classes (`.text-dark` or `.text-white`) to meet accessibility contrast.
249-
- The `.badge-pill` class has been replaced with `.rounded-pill`
250-
251-
<InvalidExample title="Don't">
252-
253-
```html
254-
<span class="badge badge-danger badge-pill">Error badge</span>
255-
```
256-
257-
</InvalidExample>
258-
259-
<ValidExample title="Do">
260-
261-
```html
262-
<span class="badge bg-danger text-white rounded-pill">Error badge</span>
263-
```
264-
265-
</ValidExample>
266-
267-
### Media
268-
269-
The `.media` component has been replaced with utility classes.
270-
271-
<InvalidExample title="Don't">
272-
273-
```html
274-
<div class="media">
275-
<div class="media-left">
276-
[...]
277-
</div>
278-
<div class="media-body">
279-
[...]
280-
</div>
281-
</div>
282-
```
283-
284-
</InvalidExample>
285-
286-
<ValidExample title="Do">
287-
288-
```html
289-
<div class="d-flex">
290-
<div class="flex-shrink-0">
291-
[...]
292-
</div>
293-
<div class="flex-grow-1 ml-3">
294-
[...]
295-
</div>
296-
</div>
297-
```
298-
299-
</ValidExample>
300-
301-
### Mixins
302-
303-
The following previously deprecated mixins will be dropped in BS5, so they can be refactored:
304-
305-
- hover, hover-focus, plain-hover-focus and hover-focus-active
306-
- float-left, float-right and float-none
307-
- nav-divider
308-
- img-retina
309-
- text-hide
310-
- invisible
311-
- form-control-focus
312-
- text-emphasis-variant
313-
- size
314-
- make-container-max-widths
315-
- g-variant and bg-gradient-variant
316-
317-
<InvalidExample title="Don't">
318-
319-
```css
320-
.collapse-list-item {
321-
padding: $collapse-list-item-padding-y $collapse-list-item-padding-x;
322-
@include hover-focus() {
323-
background-color: $collapse-list-item-hover-bg;
324-
border-color: $collapse-list-item-hover-border;
325-
}
326-
}
327-
```
328-
329-
</InvalidExample>
330-
331-
<ValidExample title="Do">
332-
333-
```css
334-
.collapse-list-item {
335-
padding: $collapse-list-item-padding-y $collapse-list-item-padding-x;
336-
&:hover,
337-
&:focus {
338-
background-color: $collapse-list-item-hover-bg;
339-
border-color: $collapse-list-item-hover-border;
340-
}
341-
}
342-
```
343-
344-
</ValidExample>
246+
See more information in [Bootstrap 5 migration](./guides/bs5migration/index.md).
345247

346248
## New course section page
347249

docs/guides/bs5migration/index.md

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
title: Bootstrap 5 migration
3+
tags:
4+
- Bootstrap
5+
---
6+
7+
<!-- markdownlint-disable no-inline-html -->
8+
9+
import {
10+
Since,
11+
ValidExample,
12+
InvalidExample,
13+
} from '@site/src/components';
14+
15+
Bootstrap 5 has evolved with new features, improvements, and changes in its latest version, and along with this some breaking changes also come, which need to be addressed in the migration process.
16+
17+
:::info
18+
19+
See more about Bootstrap 5 breaking changes in the [official documentation](https://getbootstrap.com/docs/5.0/migration/).
20+
21+
:::
22+
23+
To achieve a smoother process and facilitate the moment of the update, the migration has been divided into different steps:
24+
25+
1. **PopperJS upgrade**: This is the first step in the migration process, as Bootstrap 5 requires PopperJS version 2. This step is about upgrading the current PopperJS version to version 2. Because we still need PopperJS version 1 for Bootstrap 4 both versions will co-exist until all usages are migrated to v2.
26+
2. **SCSS Deprecation process**: A SCSS deprecation process will be needed for the cleanup after BS5 upgrade. More details about it in [SCSS deprecation](../../general/development/policies/deprecation/scss-deprecation).
27+
3. **Refactoring BS4 features dropped in BS5**: This step is about refactoring the current Bootstrap 4 features that will be deprecated or dropped in its version 5 and they can be replaced with current codebase.
28+
4. **Create a BS5 "bridge"**: Some simple breaking changes could be also addressed in advance creating a BS5 "bridge". With small additions to this "bridge", we can refactor in advance the occurences in the codebase for some dropped features in BS5.
29+
5. **BS5 upgrade**: Upgrade the current Bootstrap 4 version to version 5.
30+
6. **BS4 backwards-compatibility layer**: Alongside the update, a new backwards-compatibility layer will also be created, and some of the Bootstrap 4 syntax will still work until the final deprecation. This will help third-party plugins to be updated in a more gradual way.
31+
7. **Final deprecation**
32+
33+
:::note
34+
35+
The migration process will be done in a gradual way, and the steps will be executed in different phases. The first phase with the PopperJS upgrade, the SCSS deprecation process and the refactoring will be included in Moodle 4.4. The other steps will be ready in following releases. This documentation page will be updated accordingly with the process.
36+
37+
:::
38+
39+
## Refactoring BS4 features dropped in BS5
40+
41+
<Since version="4.4" issueNumber="MDL-79914" />
42+
43+
Some of the Bootstrap 4 classes will be deprecated or dropped in its version 5. To prepare for this, some of the current Bootstrap 4 classes usages have been replaced with version 5 compatible classes. Doing these refactors in advance, will help us to upgrade to Bootstrap 5 in the future.
44+
45+
### Badges
46+
47+
- Badge colour class helpers `.badge-*` have been replaced with background utilities (use `.bg-primary` instead of `.badge-primary`) combined with the corresponding text colour classes (`.text-dark` or `.text-white`) to meet accessibility contrast.
48+
- The `.badge-pill` class has been replaced with `.rounded-pill`
49+
50+
<InvalidExample title="Don't">
51+
52+
```html
53+
<span class="badge badge-danger badge-pill">Error badge</span>
54+
```
55+
56+
</InvalidExample>
57+
58+
<ValidExample title="Do">
59+
60+
```html
61+
<span class="badge bg-danger text-white rounded-pill">Error badge</span>
62+
```
63+
64+
</ValidExample>
65+
66+
### Media
67+
68+
The `.media` component has been replaced with utility classes.
69+
70+
<InvalidExample title="Don't">
71+
72+
```html
73+
<div class="media">
74+
<div class="media-left">
75+
[...]
76+
</div>
77+
<div class="media-body">
78+
[...]
79+
</div>
80+
</div>
81+
```
82+
83+
</InvalidExample>
84+
85+
<ValidExample title="Do">
86+
87+
```html
88+
<div class="d-flex">
89+
<div class="flex-shrink-0">
90+
[...]
91+
</div>
92+
<div class="flex-grow-1 ml-3">
93+
[...]
94+
</div>
95+
</div>
96+
```
97+
98+
</ValidExample>
99+
100+
### Mixins
101+
102+
The following previously deprecated mixins will be dropped in BS5, so they can be refactored:
103+
104+
- hover, hover-focus, plain-hover-focus and hover-focus-active
105+
- float-left, float-right and float-none
106+
- nav-divider
107+
- img-retina
108+
- text-hide
109+
- invisible
110+
- form-control-focus
111+
- text-emphasis-variant
112+
- size
113+
- make-container-max-widths
114+
- g-variant and bg-gradient-variant
115+
116+
<InvalidExample title="Don't">
117+
118+
```css
119+
.collapse-list-item {
120+
padding: $collapse-list-item-padding-y $collapse-list-item-padding-x;
121+
@include hover-focus() {
122+
background-color: $collapse-list-item-hover-bg;
123+
border-color: $collapse-list-item-hover-border;
124+
}
125+
}
126+
```
127+
128+
</InvalidExample>
129+
130+
<ValidExample title="Do">
131+
132+
```css
133+
.collapse-list-item {
134+
padding: $collapse-list-item-padding-y $collapse-list-item-padding-x;
135+
&:hover,
136+
&:focus {
137+
background-color: $collapse-list-item-hover-bg;
138+
border-color: $collapse-list-item-hover-border;
139+
}
140+
}
141+
```
142+
143+
</ValidExample>

0 commit comments

Comments
 (0)