Magento 2: How can I deploy my theme only

As of 2.1.1 you can now deploy specific themes or exclude themes:

Deploy specific themes:

php bin/magento setup:static-content:deploy --theme Magento/backend --theme Vendor/mytheme

Exclude themes:

php bin/magento setup:static-content:deploy --exclude-theme Magento/luma

enter image description here

Update these options are now in the documentation.


I'm afraid that you just can't deploy only one theme by magento console setup:static-content:deploy command.

I've been dealing with M2 frontend development for the last 2 weeks and I can affirm that the dev process it's a real PAIN! You'll lost a lot of time deploying changes due to complexity of less files hierarchy and themes fallbacks.

Anyway I'm Grunt by now here you'll find how to install, configure and use it, with Grunt you can deploy and/or recompile less files for a single theme.

So that approach it's ok if you are in "developer" mode because Grunt doesn't deploy images, fonts and javascript files to pub/static/... so magento will do it the first time required.

To activate developer mode, run:

php bin/magento  deploy:mode:set developer

If you are looking for a way to deploy the entire content for a single theme in production I sorry to say that isn't possible.

BTW I'm pretty sure that it would be a nice Feature Request to make.

EDIT: Breaking News!

I found a way to deploy all changes a little faster:

  • Install Grunt + config your theme (one for each language)
  • after each change run:
    • grunt exec:{theme_name} // Clean folders and deploy less files
    • grunt less:{theme_name} // Process less files

Voila now you'll have all your changes deployed in Just(¿?) 12~16 sec, 12 sec is my personal record!

EDIT: Breaking News 2!

Confirmed! if you are making changes to a (already deployed) .less files just run grunt less:{theme_name}.

So, you have to run grunt exec:{theme_name}only when:

  • Add/Remove/Rename a *.less File
  • Add/Remove/Rename a *.js Fils
  • Add/Remove/Rename a *.css File
  • Add/Remove/Rename a image File
  • Add/Remove requirejs-config.js

Additionally I disabled blocks, layouts and full page Caches, so any change to templates and/or xml layouts will be displayed automatically.


In Magento 2 you are able to content deploy specific themes and also exclude themes by this commands:

Content Deploy specific themes By this command:

php bin/magento setup:static-content:deploy --theme Vendor/firsttheme --theme Vendor/secondtheme

Exclude themes By this command:

php bin/magento setup:static-content:deploy --exclude-theme Vendor/yourtheme

If you need deploys static content for particular language (en_US), and exclude other theme, and need not minify HTML files then use this command:

magento setup:static-content:deploy en_US --exclude-theme Vendor/yourtheme --no-html-minify