Magento 2: How to deploy an image file on production site?
-
19-01-2021 - |
Question
We changed one image file at this location and now we want to deploy it on live:
app/design/frontend/theme/theme1/web/images/sample.jpg
We learned that the only way to deploy static files in production is:
php bin/magento setup:static-content:deploy en_AU -f
This command takes time to complete and we need to take the site down for around 30 minutes just to update production. This isn't useful for us.
Do you have any recommendation to optimize the process of updating small static files?
Solution
@LAW, is correct. For the current version of Magento 2, it is impossible to deploy selected static files. What we do is we keep our Magento 2 websites's mode to developer
. If you are in production
mode, the fastest route is to manually replace or update the file in your pub/static files. In your question, you deploy in en_AU, so path should be similar below:
pub/static/frontend/theme/theme1/en_AU/images/sample.jpg