To perform the necessary actions via SSH, navigate to the Magento root directory and execute the following commands:
rm -rf var/view_preprocessed/code/* rm -rf var/view_preprocessed/metadata/* rm -rf pub/static/adminhtml/* rm -rf pub/static/frontend/* rm -rf pub/static/_cache/*
php bin/magento setup:static-content:deploy -f en_US -t Magento/backend php bin/magento setup:static-content:deploy -f en_US -t Habi/flexmarket_child
Note
To deploy static content for all themes, remove the -t parameter from the command. For multiple languages, simply list the desired language codes, as shown below:
php bin/magento setup:static-content:deploy -f en_US fr_FR es_CO
You can automate the static content deployment process by creating a shell script (e.g., deploy-theme.sh) and placing it in your Magento root directory.
Inside the file, include the following commands:
rm -rf var/view_preprocessed/code/* rm -rf var/view_preprocessed/metadata/* rm -rf pub/static/adminhtml/* rm -rf pub/static/frontend/* rm -rf pub/static/_cache/* php bin/magento setup:static-content:deploy -f en_US -t Magento/backend php bin/magento setup:static-content:deploy -f en_US -t Habi/flexmarket_child php bin/magento cache:flush
Note: Make sure to update en_US and Habi/flexmarket_child according to your language and theme.
Each time you need to deploy static content, simply execute:
sh deploy-theme.sh
This approach saves time and ensures consistency when deploying static assets.