If I use the module:enable or module:disable command to enable or disable a module,

php bin/magento module:enable Pulsestorm_TutorialObjectManager1
php bin/magento module:enable Pulsestorm_TutorialObjectManager1

The output will include the following contents

Alert: Generated static view files were not cleared. You can clear them using the --clear-static-content option. Failure to clear static view files might cause display issues in the Admin and storefront.

What exactly is a static generated view file?

Where do these files live?

If I include the --clear-static-content option am I just deleting files, or will this reset other things in the system as well?

2 Answers 2


It appears just to remove files (and print some output). With that flag set the stack contains:


which empties these directories (see \Magento\Framework\App\Filesystem\DirectoryList):

DirectoryList::STATIC_VIEW == 'static'
DirectoryList::VAR_DIR == 'var'
DirectoryList::TMP_MATERIALIZATION_DIR == 'view_preprocessed'

If I search for uses of DirectoryList::STATIC_VIEW, I see a lot of output, but notably most of it has to do with deploying and cleaning CSS and merged JS. Without further digging, I think it's safe to say a "static view" is a post-processed static asset file such as CSS and JS. I'm curious to see how developers extend and modify this feature.


"View" refers to presentation layer (from MVC).

"Static" means it can be cached for a site (it's not dynamic). Eg CSS generated from LESS files.

In production we can pre-compute the files. In developer mode we can generate on demand, but the rest is cached in a file for speed. So if you load a new module, it might load new JS, CSS, layout file, etc - so you need to flush the old files to make sure you get all the changes for the new module.

Clearing static content at moment delete files. One day it might do more, but no plans yet that I know of.

They live in pub/static - but there are cached files under /var as well.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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