Magento 2 – Deploy Only Used Themes to Speed Up Static Deploy

deploymentmagento2theme

Does anyone know if it's possible to restrict the setup:static-content:deploy to only deploy themes I actually use?

For instance i have a theme that inherits from Magento/blank and we have two languages, also we normally don't change the admin area.

So I only need
pub/static/frontend/MyScope/mytheme/en_GB and pub/static/frontend/MyScope/mytheme/en_US and
pub/static/adminhtml/*

however I don't need all the others that are also being generated. I tried to at least uninstall luma but It didn't work and Magento/blank I can't remove because my theme inherits from it but it's not used in production.

Anyone got an idea?

Best Answer

According to this Magento 2 Github issue the functionality for this has not yet been implemented although they are in discussions about adding it.

As a workaround you can apparently delete and uninstall the luma theme (see instructions in my quote below) from the vendor directory and it will skip it. You may need to clear var/view_preprocessed, pub/static, and clear you caches for it to work though.

Comment from Alan Kent is on that github issue:

(If you want a short term hack, you can delete the Luma theme directory under 'vendor' so Magento does not see it any more. Make sure you run the CLI to uninstall the theme as well so it disappears from database etc. http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-theme-uninstall.html. Yes, we need a better solution, but it may remove some immediate pain.)

Related Topic