Last active
November 8, 2023 19:42
-
-
Save Juan-escobar94/f76535a1264ac6f7251c643af50c184d to your computer and use it in GitHub Desktop.
Migrate bootstrap 4 classes to bootstrap 5.
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
set -x | |
set -e | |
# e.g. folder to process e.g. "frontend/" | |
migration_folder=$1 | |
find_regex=".*/*.tsx?" # mach all .ts and .tsx files | |
# include trailing path "/" in folder parameter: e.g "frontend/" instead of just "frontend" | |
ignore_path="*/$1node_modules/*" | |
# Back up your files or change sed argument -i to -i.bak to generate backup files | |
find $migration_folder -regextype posix-egrep -regex $find_regex -type f -not -path $ignore_path | xargs sed -i -E '/[(class)(")]/{ | |
s/([mp])l(-[0-5])/\1s\2/g | |
s/([mp])r(-[0-5])/\1e\2/g | |
s/no-gutters/g-0/g | |
s/ close / btn-close /g | |
s/arrow/popover-arrow/g | |
s/left(-[0-9]*)/start\1/g | |
s/right(-[0-9]*)/end\1/g | |
s/(float|border|rounded|text)-left/\1-start/g | |
s/(float|border|rounded|text)-right/\1-end/g | |
s/font-weight(-[a-zA-Z]*)/fw\1/g | |
s/font-style(-[a-zA-Z]*)/fst\1/g | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://properprogramming.com/tools/converters/bootstrap-4-to-bootstrap-5-converter/