Magento 2 - flush and rebuild oneliner

Sometimes we need to start afresh, and don't want to think about what to flush and when to flush it.

Sometimes we need to start afresh, and don't want to think about what to flush and when to flush it. We use this oneliner to upgrade the magento configuration, compile the code, and static-deploy the frontend chunks.

bin/magento setup:upgrade && bin/magento setup:di:compile && bin/magento setup:static-content:deploy -f --jobs=5 && bin/magento cache:flush

If you want to make sure the folders can be deleted properly without customers building cache folders while you regenerate the application, enable and disable maintenance mode before running this. This can be helpfull on domains with larger amount of traffic

bin/magento maintenance:enable && bin/magento setup:upgrade && bin/magento setup:di:compile && bin/magento setup:static-content:deploy -f --jobs=5 && bin/magento cache:flush && bin/magento maintenance:disable

Created by Daniel on 11/22/2024

Copyright © DanielKnows.com 2019 - 2024 - Built with NuxtJS

Subscribe for Tech Tips!

Stay updated with the latest tech insights and tips. Subscribe now!

{}