Which compilation commands are needed in developer mode and when?

pay attention: I've experienced that in developer mode deleting the pub/static will break the mechanism because you get rid of the .htaccess file that makes the magic in that folder.

If you keep the pub/static/.htaccess file in developer mode you don't need to run any compilation command: Magento will create symlinks to files as soon as they are requested. That means that changes to static assets will be visible immediately, provided you also have cache disabled.

You can delete the pub/static/frontend or pub/static/adminhtml instead.

In default mode assets are materialized in pub/static subfolder, meaning they are created (copied, not symlinked) at first request. If you modify them you have to flush the cache to have them updated.

In production mode assets are not materialized (causing 404 HTTP error upon request) until you run the bin/magento setup:static-content:deploy command.

Hope it helps.


from my experience, you don't need to run any commands for code / static-file generation in developer mode.

If the static files were not generated, there might be another issue.

I see two reasons for that on first sight:

  • developer mode is not working correctly. maybe the activation failed for some reason
  • the rewrite for static files on the pub/static.php is not working

Does that mean, each individual file in pub/static is generated when it is requested and you never need to call setup:static-content:deploy? This contradicts my experience. Or can I delete any files and they will be regenerated?

Yes. But according to my experience this doesn't work most of the time. Might be a bug. Better solution is to delete pub/static content and deploy static content again whenever you changed static file(js, css, html, etc.) even you have already activated developer mode. My own question about this.