0

What is the most Optimal Development Workflow using Magento 2.3.5 in 2020?

I've got a Task to create Magento 2 Module.

When i upload the written code to server the page doesn't update the code (CSS for Example).

I've tried:

  • disabling Cache
  • using Cache/Flush
  • changing to Developer Mode
  • removing generated code

The only way for the Page to take my changes is:

php bin/magento setup:upgrade
php -d memory_limit=-1 bin/magento setup:di:compile
php -d memory_limit=-1 bin/magento setup:static-content:deploy 
php bin/magento index:reindex
php bin/magento cache:clean

The Problem is that this way of doing things takes a lot of time.

There must be a better Way of doing this, but i couldn't find the right solution for it.

Any Ideas?

2
  • You need to deploy the module, then it will accept your changes. Sep 4, 2020 at 9:50
  • @DhirenVasoya What do you mean by Deploy the module? I've enabled the Module already.
    – Piotr
    Sep 4, 2020 at 10:23

1 Answer 1

0

If you want to develop new module for Magento 2, it's recomended to switch to Developer mode (php bin/magento deploy:mode:set developer). And I recommend you to enable all magento cache, because it can take too much time to load, if you doesn't.

To see your less/css changes your should clean static files (rm -rf pub/static var/view_preprocessed) and load page with disable cache browser option.

If you want to see your DI changes (changes in di.xml files), you should flash di cache (rm -rf generated/metadata/ && rm -rf generated/code/)

If you want to see all other changes on the frontend, you need to flush specific magento cache (or all cache). Command: php bin/magento cache:flush

If you created new magento module (required files: registration.php and etc/module.xml), you should run php bin/magento setup:upgrade to register module in the system (list of registered modules - app/etc/config.php)

When you deploy the website to live environment, you should switch your magento to production mode (php bin/magento deploy:mode:set production) and run following commands:

php bin/magento setup:upgrade
php bin/magento setup:di:compile // to update di changes
php setup:static-content:deploy // to update static files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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