Skip to content

Instantly share code, notes, and snippets.

@christianwgd
Last active August 17, 2023 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianwgd/c579a87ed4edcdc768cc3005c5135c86 to your computer and use it in GitHub Desktop.
Save christianwgd/c579a87ed4edcdc768cc3005c5135c86 to your computer and use it in GitHub Desktop.
Bash script for basic migration from django-bootstrap4 to django-bootstrap5
find . -type f -name \settings.py -exec sed -i '' -e "s|'bootstrap4',|'django_bootstrap5',|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|bootstrap4\/bootstrap4.html|django_bootstrap5\/bootstrap5.html|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|bootstrap4_extra_head|bootstrap5_extra_head|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|bootstrap4_extra_script|bootstrap5_extra_script|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|bootstrap4_title|bootstrap5_title|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|bootstrap4_content|bootstrap5_content|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s| bootstrap4 | django_bootstrap5 |g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|data-toggle=|data-bs-toggle=|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|data-dismiss=|data-bs-dismiss=|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|data-targe=|data-bs-targe=|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|data-parent=|data-bs-parent=|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|mr-auto|me-auto|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|ml-auto|ms-auto|g" {} \;
find . -type f -name \*.html -exec sed -i '' -e "s|dropdown-menu-right|dropdown-menu-end|g" {} \;
@christianwgd
Copy link
Author

Copy the bash script to the root of your django project and make it executable with "chmod +x bs4-2-bs5.sh, run with ./bs4-2-bs5.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment