1

Every time I change some code when developing a module, I run php bin/magento setup:upgrade. The problem is when executing this command, I end up with the deletion of the static front and admin css file as the command outputs this :

C:\xampp\htdocs\magento>C:\xampp\php\php.exe bin/magento setup:upgrade Cache cleared successfully File system cleanup: C:/xampp/htdocs/magento/var/generation/Composer C:/xampp/htdocs/magento/var/generation/Magento C:/xampp/htdocs/magento/var/generation/Symfony C:/xampp/htdocs/magento/var/generation/Ves The directory 'C:/xampp/htdocs/magento/var/di/' doesn't exist - skipping cleanup C:/xampp/htdocs/magento/pub/static/_requirejs //all static files cleared C:/xampp/htdocs/magento/pub/static/adminhtml //all static files cleared C:/xampp/htdocs/magento/pub/static/deployed_version.txt //all static files cleared C:/xampp/htdocs/magento/pub/static/frontend //all static files cleared C:/xampp/htdocs/magento/var/view_preprocessed/css C:/xampp/htdocs/magento/var/view_preprocessed/source Updating modules: ...

So I'm every time I have to execute php bin/magento setup:static-content:deploy to have a full functional front and esepcially backend (to create products, update categories, etc ...) .

My question is, is there any other method to apply code changes, or can I tell the script to ignore some directories (/pub/static/*) ?

1 Answer 1

1

You can use this command:

php bin/magento setup:upgrade --keep-generated

Checkout this link for further documentation: http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-uninstall.html#instgde-install-keep

But it would be better to run Magento 2 in developer mode. When you're in developer mode Magento automatically regenerates the pub/static folder when you delete it.

You can activate developer mode via the CLI:

php bin/magento deploy:mode:set developer

More details here http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-mode.html

Your Answer

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

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