Repository navigation
v5.2.0: Bootstrap 4 compatibility SCSS; Bootstrap.defaultLoadCss - #15
Merged
Merged
Conversation
- lib/bootstrap-5/bs4-compat: Bootstrap 5 normalized to look like
Bootstrap 4, for apps moving from 4.x:
- _variables.scss: Bootstrap 4 values for the variables whose defaults
changed (all !default).
- _rules.scss: Bootstrap 4 styles without a Bootstrap 5 variable
(checkbox/radio padding, date inputs, lists indent, .badge/.card
color, .form-control, .table borders keeping .table-bordered and
.table-borderless, .navbar-brand) and BSAccordion with the 4.x look.
- _class-aliases.scss (optional): Bootstrap 4 class names.
- bootstrap.scss: variables + Bootstrap 5 + rules.
- Bootstrap.defaultLoadCss: the load() loadCss when not passed, also for
the package's own load() calls (e.g. enableTooltip).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For apps moving from
4.x(Bootstrap 4): a SCSS that normalizes Bootstrap 5 to look like Bootstrap 4, so the fixes each app would otherwise make are shared.lib/bootstrap-5/bs4-compatbootstrap.scss:_variables+ the bundled Bootstrap 5 SCSS +_rules._variables.scss(all!default, app variables win): Bootstrap 4 values for the variables whose defaults changed: border radius, no responsive font sizes, links without underline,<small>/<code>,<hr>,.badge,.btn-warningtext ($color-contrast-dark),.card,.form-control,.table,.navbar(padding, colors, no toggler ring after a tap), and the accordion._rules.scss: Bootstrap 4 styles without a Bootstrap 5 variable: checkboxes/radios without padding (dropped from the reboot), date inputs height, lists indent, inherited.badge/.cardcolors,.form-controlappearance,.tableborders (keeping.table-bordered/.table-borderless),.navbar-brand, andBSAccordionwith the 4.x look: each item a.card(relative flex column, own borders/radius), header a.card-header(inherited font), button a.btn-link(centered, parts spread, no chevron, hover/focus underline), body a.card-body._class-aliases.scss(optional): Bootstrap 4 class names extending their Bootstrap 5 classes (float-right,text-left,ml-2/mr-md-auto/...,font-weight-bold,font-italic,sr-only,badge-pill,badge-primary,no-gutters,custom-select,form-group,btn-block, ...).These come from migrating a production app from 4.x, each checked by comparing computed styles (old Bootstrap 4 CSS vs Bootstrap 5 + these files) in headless Chrome.
Bootstrap.defaultLoadCssload({bool? loadCss})now defaults toBootstrap.defaultLoadCss. Only the firstloadcall loads, and the package itself callsload()(e.g.enableTooltip), so an app compiling its own Bootstrap CSS setsBootstrap.defaultLoadCss = falseat start instead of relying on itsload(loadCss: false)being first.Tests
bones_ui_bootstrap_bs4_compat_vm_test.dart: compiles through thepackage:URL; variables, rules after the Bootstrap rules they override,.table-bordered/.table-borderless, accordion, app variable override, variables-only import outputs nothing, class aliases.bones_ui_bootstrap_default_no_css_test.dart:defaultLoadCss = falsewithenableTooltipmaking the firstload.dart test -p vm: 28 passed.dart test -p chrome: 65 passed.dart analyze,dependency_validator: clean.🤖 Generated with Claude Code