Merge JS/CSS files
-
01-03-2021 - |
Question
I'm trying to compress the code files on my magento 2 store. And so we wanted to use the Merge JS/CSS files in the magento 2 admin.
We are not programmers, and we would like to not have to contact programmes to fix any problems because of high cost.
So what i'm wondering is, how big is the chance that something goes wrong with the site when i merge the files? and if anything goes wrong, can i just Unmerge them and everything will be fine?
Solution
First Change deploy mode into a developer mode
Terminal command
php bin/magento deploy:mode:set developer
Open admin panel and follow the below steps
1.Store->configuration->advanced -> developer
Js minify and merge
Set yes for below configuration under Javascript tab
- Merge JavaScript Files
- Enable JavaScript Bundling
- Minify JavaScript Files
CSS minify and merge
set yes for below configuration under CSS setting
- Merge CSS Files
- Minify CSS Files
after set deploy mode into prodcution
Terminal command
php bin/magento deploy:mode:set production
Revert
If you want to revert minify and merge, Set no to above configuration and then change into production mode
Terminal command
php bin/magento deploy:mode:set production
OTHER TIPS
You just need to revert back that setting.
if admin not work, then go to PHPMyAdmin
and find entry into core_config_data like
select * from core_config_data where path like '%merge%';
and change entry to 0 and do cache flush then your store will revert back