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
- Take a bs_base 1.x child theme whose SASS has
@import "bootstrap/scss/utilities/spacing";. - Run
drush bs-tu <theme>with bs_base 2.0.x. - 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/screenreaderstohelpers/visually-hidden,utilities/stretched-link,utilities/clearfix,utilities/position.input-grouptoforms/input-groupas today.
- Put the patterns in
_bs_base_bs5_import_regexps(), accepting either quote, an optional leading underscore and an optional.scsssuffix.200006uses it for themes not yet updated. - Add
bs_base_bs_update_200013()for themes that already recorded200012. It applies the same list, rewrites leftoverbs_bootstrap/import paths tobs_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
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
Comment #4
pivica commentedFixed.