Skip to content

Deploying static files

For performance, Magento 2 now generates static files from your theme and other site components. This feature is well documented in the Magento 2 dev docs, but there are some tricks to deploying and generating these files on a MageMojo server.

Before deploying static files, remove any files — except the .htaccess file — in pub/static.

The following should also be removed, especially when doing a production deployment.

  • All folders under pub/static
  • var/cache
  • var/composer_home
  • var/generation
  • var/page_cache
  • var/view_preprocessed
  • var/di (if present)

Then the static files can be deployed using the following command (run from the bin directory in the Magento install).

php bin/magento setup:static-content:deploy