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

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?


3 Answers 3


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.)

  • 2
    FYI there is a PR that will add this capability and a lot more. I think it'll probably come out with v2.2.
    – thdoan
    Commented Jun 28, 2016 at 11:03

Now it possible.

You can use options --theme/--exclude-theme to restrict the list of themes to use.

Also, see more options to restrict items to deploy:

bin/magento setup:static-content:deploy --help
 setup:static-content:deploy [-d|--dry-run] [-f|--force] [--no-javascript] [--no-css] [--no-less] [--no-images] [--no-fonts] [--no-html] [--no-misc] [--no-html-minify] [-t|--theme[="..."]] [--exclude-theme[="..."]] [-l|--language[="..."]] [--exclude-language[="..."]] [-a|--area[="..."]] [--exclude-area[="..."]] [-j|--jobs[="..."]] [--symlink-locale] [languages1] ... [languagesN]

 languages             Space-separated list of ISO-636 language codes for which to output static view files.

 --dry-run (-d)        If specified, then no files will be actually deployed.
 --force (-f)          Deploy files in any mode.
 --no-javascript       Do not deploy JavaScript files
 --no-css              Do not deploy CSS files.
 --no-less             Do not deploy LESS files.
 --no-images           Do not deploy images.
 --no-fonts            Do not deploy font files.
 --no-html             Do not deploy HTML files.
 --no-misc             Do not deploy other types of files (.md, .jbf, .csv, etc...).
 --no-html-minify      Do not minify HTML files.
 --theme (-t)          Generate static view files for only the specified themes. (default: ["all"]) (multiple values allowed)
 --exclude-theme       Do not generate files for the specified themes. (default: ["none"]) (multiple values allowed)
 --language (-l)       Generate files only for the specified languages. (default: ["all"]) (multiple values allowed)
 --exclude-language    Do not generate files for the specified languages. (default: ["none"]) (multiple values allowed)
 --area (-a)           Generate files only for the specified areas. (default: ["all"]) (multiple values allowed)
 --exclude-area        Do not generate files for the specified areas. (default: ["none"]) (multiple values allowed)
 --jobs (-j)           Enable parallel processing using the specified number of jobs. (default: 4)
 --symlink-locale      Create symlinks for the files of those locales, which are passed for deployment, but have no customizations
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question

To deploy selectively static content, use the following CLI command:

php bin/magento setup:static-content:deploy --theme=Vendor/themename 

Keep in mind, that in Developer mode you don't need to deploy static content at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.