cancel
Showing results for 
Search instead for 
Did you mean: 

Is it recommended to DELETE PUB folder as part of Static Content ?

SOLVED

Is it recommended to DELETE PUB folder as part of Static Content ?

Hi,

 

Are we supposed to delete entire PUB Folder to regenrate the static content in Magento V 2.3 ?

or Just the pub/static.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Is it recommended to DELETE PUB folder as part of Static Content ?

Hi @rajiv_varma n1,

It is not mandatory to remove files from the directory...

In case some changes are not reflecting and you want to remove and run static-content deploy command again.

Then you don't need to delete entire pub folder. You can delete only pub/static only.

For frontend changes: pub/static/frontend

For admin
pub/static/adminhtml

I hope it will help you!

View solution in original post

4 REPLIES 4

Re: Is it recommended to DELETE PUB folder as part of Static Content ?

Hi @rajiv_varma n1,

It is not mandatory to remove files from the directory...

In case some changes are not reflecting and you want to remove and run static-content deploy command again.

Then you don't need to delete entire pub folder. You can delete only pub/static only.

For frontend changes: pub/static/frontend

For admin
pub/static/adminhtml

I hope it will help you!

Re: Is it recommended to DELETE PUB folder as part of Static Content ?

@rajiv_varma n1You should not be deleting the folder unless it is a show stopper. If you have correct permission in place things should work for you. Just think if you are deleting those folders on production? Why would you do that?

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Is it recommended to DELETE PUB folder as part of Static Content ?

Hi @rajiv_varma n1 

 

I am agree with the @Vimal Kumar suggestions. But make sure to not delete the .htaccess file inside the pub/static directory. If you are removing this directory manually.

 

Thanks

Re: Is it recommended to DELETE PUB folder as part of Static Content ?

I agree to all your responses. My initial thought was the same, there is no reason to delete the whole PUB directory.

 

For some reason, someone pointed out to delete the PUB, VAR and GENERATED folders,  and run the commands to generate them again. To test that the site was developed correctly.

 

As far as i know, mostly pub/static is one folder that can be deleted and then deployed again to run or test the development site.

 

i was just making sure, if what i was thinking was right. thats why i asked this question to verify my thoughts if i was in rightdirection.

 

Also, to test this, i had installed a Stock Magento 2.3, once installed and working fine, i deletd the PUB, VAR and GENERATED folders, like the XXXX person was doing to my development site to test if the development that was done was correct. But after i did that, the site stopped loading the CSS, Images and JS. Which confirmed my question, that PUB folder is not to be deleted at all, because apart from static files it also contains other important files to run.

 

Thanks