Question

How do you compile with you only what you want with "setup:static-content:deploy" ?
How can compile only current theme ?
How can compile only .less files of theme ?

Was it helpful?

Solution

If you want to compile only theme (Package/Theme) with all that belongs to it, run the command:

php bin/magento setup:static-content:deploy --theme Package/Theme


If you want to compile two themes, run the command:

php bin/magento setup:static-content:deploy --theme Package/Theme --theme Package/Theme


If you want to compile the theme only .less files, run the command:

php bin/magento setup:static-content:deploy --theme Package/Theme --no-javascript --no-css --no-images --no-fonts --no-html --no-misc --no-html-minify


To understand how it works and to see how many compilation options exist, run the command:

php bin/magento setup:static-content:deploy -h

The result is:

Usage:
 setup:static-content:deploy [-d|--dry-run] [--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]

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

Options:
 --dry-run (-d)        If specified, then no files will be actually deployed.
 --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


You can compile depending on the language.
You can compile excluding a theme
You can use combinations of options

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top