cancel
Showing results for 
Search instead for 
Did you mean: 

Merged JS and CSS do not work when Production mode

SOLVED

Merged JS and CSS do not work when Production mode

I was in developer mode, everything was great, when I changed to Production mode, the Merged options of CSS and JS seems to be ignored, it was back listing all css and js.

 

Also The product page only shows the pictures of the product in developer mode, also changing to production mode it disappear.

Any thought to help me?

 

Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Merged JS and CSS do not work when Production mode

Hey Guys.

 

I just did the following and the problem was solved.

 

bin/magento setup:upgrade

bin/magento indexer:reindex

bin/magento deploy:mode:set production -s

bin/magento setup:di:compile (Here was the secret, to run the di:compile after production)

bin/magento setup:static-content:deploy

 

Thanks

View solution in original post

9 REPLIES 9

Re: Merged JS and CSS do not work when Production mode

In the production mode (in contrast to the developer mode) the static content should be deployed manually: https://mage2.pro/t/759

Re: Merged JS and CSS do not work when Production mode

Hi there.

 

The point is, I'm doing it.

 

Here is what I did in sequence:

 

bin/magento setup:upgrade

bin/magento indexer:reindex

bin/magento setup:static-content:deploy

bin/magento setup:di:compile

bin/magento deploy:mode:set production

bin/magento setup:static-content:deploy

 

And before even start, the Merge options are YES and I was in developer mode.

 

Re: Merged JS and CSS do not work when Production mode

Hey Guys.

 

I just did the following and the problem was solved.

 

bin/magento setup:upgrade

bin/magento indexer:reindex

bin/magento deploy:mode:set production -s

bin/magento setup:di:compile (Here was the secret, to run the di:compile after production)

bin/magento setup:static-content:deploy

 

Thanks

Re: Merged JS and CSS do not work when Production mode

Hello,

 

I have the same problem and tried the same steps as you did. However, I still have the same problem. 

 

Additional to your steps, I checked all folder permissions and flushed the cache, but nothing seems to work here.  The problem exists in both the front and backend of my site.

 

Before I changed to production mode, everything worked fine. When I changed back to developer mode, the problem still exists.

 

 

Does anyone have an idea about what could be wrong?

 

Thanks

 

 

Re: Merged JS and CSS do not work when Production mode

How does this marked as solved? I tried all the solutions suggested here but still the same problem. JS only working on developer mode, after switching to production it keeps not working.

Re: Merged JS and CSS do not work when Production mode

I am facing the same issue my css and js are not merged.please let me know if you have got any solution

Re: Merged JS and CSS do not work when Production mode

Really problem solved?  Still the same problem.  developer mode Working, after switching to production same problem

Re: Merged JS and CSS do not work when Production mode

For the javascript, follow the instructions here, to set the config options from the console:

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/themes/js-bundling.html

 

For CSS you need to do something similar to manually enable it. The following has worked for me:

bin/magento config:set dev/css/merge_css_files 1
bin/magento config:set dev/css/minify_files 1

 

Then just do the standard upgrade, compile, deploy sequence.

Re: Merged JS and CSS do not work when Production mode

Hi,

As per the suggestion of adobe documentation to remove write access from some directories like var, pub/static and app/etc/ in that case CSS and JS file does not generated because of directory doesn't have the write permission as per the suggested document by adobe https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/deployment/file-syst...

If i given write permission to pub/static directory then my problem is solved but is that right to give write access permission to pub/static or is any other way to solve this problem.

 

please suggest.

 

Regards,

Rohit Chauhan

Regards,
Rohit Chauhan
M2 Certified Expert