When to compile and deploy content
-
12-02-2021 - |
Domanda
After a year or so of working in Developer Mode
, I'm now using Production Mode
.
As I deploy updates to modules or designs, I'm wondering when I should run the below commands. At the moment, my order of operations is:
- Update files in
app/code
orapp/design
- Run
bin/magento setup:di:compile
- Run
bin/magento setup:static-content:deploy en_GB
Is this still necessary when updating something like a stylesheet or template?
Soluzione
php bin/magento setup:upgrade
:
Upgrades the Magento application, DB data, and schema
php bin/magento setup:di:compile
:
Generates DI configuration and all missing classes that can be auto-generated
php bin/magento setup:static-content:deploy
:
Deploys static view files
CSS where is it placed ? in view files : app/design/frontend/{Theme}/{name}/web/css/custom.css
or app/code/Vendor/Name/view/frontend/web/css/custom.css
So YES you need to deploy the static-contents
on production mode.
Magento DevDocs says :
The static view files deployment command enables you to write static files to the Magento file system when the Magento software is set for production mode.
Good luck
Altri suggerimenti
The brief answer is yes for stylesheet/templates you would then need to redeploy the static content. You wouldn't need to compile.
Compilation would be required for something like, for example, adding a new extension or adding a new instance of a model into an existing module.