Problem/Motivation

bs_base_bs_update_200006() migrates child theme SASS from Bootstrap 4 to Bootstrap 5. It removes the imports of code, custom-forms, print, utilities/text, utilities/background and utilities/sizing, and moves utilities/screenreaders, utilities/stretched-link and input-group.

Bootstrap 5 builds its utility classes from the $utilities map and utilities/api, so every Bootstrap 4 utilities/* file is gone. The hook does not remove the others, for example utilities/borders, utilities/flex, utilities/shadows and utilities/spacing. A child theme that imports them fails its gulp build with "File to import not found or unreadable", one import at a time.

The patterns also match only double quotes, and most of them only the form without the .scss suffix, so @import 'bootstrap/scss/code'; or @import "bootstrap/scss/utilities/spacing.scss"; stays.

Steps to reproduce

  1. Take a bs_base 1.x child theme whose SASS has @import "bootstrap/scss/utilities/spacing";.
  2. Run drush bs-tu <theme> with bs_base 2.0.x.
  3. The build fails on that import.

Proposed resolution

Compared the Bootstrap 4.6.2 and 5.3.8 scss/ trees to get the complete list:

  • Remove: code, custom-forms, jumbotron, media, print, utilities/align, background, borders, display, embed, flex, float, interactions, overflow, shadows, sizing, spacing, text, visibility.
  • Move to helpers/: utilities/screenreaders to helpers/visually-hidden, utilities/stretched-link, utilities/clearfix, utilities/position. input-group to forms/input-group as today.
  • Put the patterns in _bs_base_bs5_import_regexps(), accepting either quote, an optional leading underscore and an optional .scss suffix. 200006 uses it for themes not yet updated.
  • Add bs_base_bs_update_200013() for themes that already recorded 200012. It applies the same list, rewrites leftover bs_bootstrap/ import paths to bs_base/, and warns when a theme uses .embed-responsive, which Bootstrap 5 replaces with .ratio. Every entry is safe to apply twice.

Issue fork bs_base-3626557

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pivica created an issue. See original summary.

  • pivica committed 943396e9 on 2.0.x
    fix: #3626557 bs_base_bs_update_200006() removes only part of the BS4...
pivica’s picture

Status: Active » Fixed

Fixed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.