I'm wondering how to handle the setup:static-content:deploy command in production efficiently, right now I'm running the command after setup:upgrade however I run into an issue where frontend assets are missing for a few seconds before the static content is finished generating.

I tried running setup:upgrade --keep-generated so static content doesn't get cleared, however if the static assets already exists it looks like the setup:static-content:deploy command ignores them and doesn't update them with new changes. As far as my tests go it seems that I need to clear the static folder so files with new changes get generated.

I know it's possible to generate assets on a build server after 2.2, so we don't have to run this process on the production server, but looking at the options this seems to rely on copying these assets manually (by adding them to source control, copying them via rsync, scp, etc).

Knowing this my main question is: is there a way to make setup:static-content:deploy overwrite the already existing assets with the new ones without clearing them first? This would avoid all the issues I'm having.

  • did you try the command setup:static-content:deploy -f ? – Naveed Asim Mar 9 '18 at 10:21
  • Yes but no help, it still skips done files if they're already generated. – Javier Villanueva Mar 10 '18 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.