How To Clear Magento Directory During Its Development?

Learn how to clear the Magento directory during its whole development process in this blog.

When you are extending the Magento theme or module, your fast-changing environment needs you to periodically clear certain directories and cache. Or else, your code runs with exception and won’t function properly.

Lift the eCommerce business to the next level with our Magento solution!!!

Clear Magento Directory During Its Development

Clear Magento Directory During Its Development

There are some cases that will clear the Magento directory to make a code even clearer,

Case 1:

You must clear these directories var/di, var/generation for

  • Change a class if there is a plug-in related to it.
  • A change that results in generated factories or proxies

Case 2:

To change any di.xml

var/generation, It also runs the code compiler again

Case 3:

For add, remove, disable, enable the module

var/di, var/generation, var/cache, var/page_cache

Case 4:

For edit layout or theme

var/view_preprocessed, var/cache, var/page_cache

Case 5:

To change LESS or templates

var/view_preprocessed, var/cache, var/page_cache as well

Case 6:

Add or edit a CMS page, cache blocks, or use Magento admin to change the configuration.

var/cache, var/page_cache

You can also use the following command-line tools to clear some directories for you

Magento setup: Upgrade

This tool upgrades the Magento database scheme and data using

Var/di ,var/generate

Magento setup:di:compiler

This generates code

var/generation

Magento deploy:mode: Set

It changes developer mode to production mode and vice versa

var/di, var/generation, var/view_preprocessed

Magento cache: Clean

It cleans the cache using var/cache, var/page_cache

The following cases will provide guidelines to clear the Magento directory during the development of Magento 2.

Clear directory during development in Magento 2

Last Update: May 5, 2021  

February 6, 2018   536   Nandini Ramachandran    Magento, Magento 2 Tutorial, Magento2    
Total 1 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
Twitter
INSTAGRAM
LinkedIn