3

It appears that there is no longer a "Developer" tab in the Admin Configuration/Advanced tab in version 2.2.5 production mode. Although the documentation still indicates there is, I have seen a couple of references in the blogs about its removal.

I am trying to figure out how to minify and merge my js and css files, or if I really should?

3 Answers 3

5

Minifying and merging js and css can improve load times and general performance of your store, so it should be enabled in production mode, but if you have to do any kind of development then you should not enable it.

In production mode the developer tab in admin store configuration in removed so you have to manually enter values in db to enable and disable them.

Following are the fields you need to set 0 or 1 in core_config_data table to disable/enable these settings;

dev/js/merge_files  - Merge Js
dev/js/minify_files - Minify Js

dev/css/merge_css_files - Merge css
dev/css/minify_files - Minify css

You can also choose to bundle js files, which would reduce the number of requests done to site to improve load times by setting following ;

dev/js/enable_js_bundling - Bundle Js Files

Do not forget to deploy your static content and flush cache using following commands after modifying any of these fields;

php bin/magento setup:static-content:deploy
php bin/magento cache:flush
6
  • Thanks for the input! After changing the settings, alot of things don't display properly on the website. But I did get an 'A' from google pagespeed :-/ I suspect the theme I am using can't handle the js bundling. Unfortunately, when I tried to set the fields back to 0 in core_config_data and then deploy static content, I received an error- PHP Fatal error: Uncaught Error: Call to a member function getPackage() on null in /home/199035.cloudwaysapps.com/yzsaztxymz/public_html/vendor/magento/module-deploy/Package/Processor/PostProcessor/CssUrls.php:215
    – DStephens
    Aug 31, 2018 at 23:01
  • rename your pub/static and var folder and re run deploy Aug 31, 2018 at 23:03
  • Is it only possible via database?!
    – Black
    Feb 13, 2020 at 14:53
  • 1
    @Black it's possible to do in admin if you have developer mode enabled. Then the developer tab will show and you can configure these settings there. But if you're in production mode you have to do it by the database.
    – utklasad
    Apr 20, 2020 at 13:23
  • Where exactly?.
    – Black
    Apr 20, 2020 at 13:36
6

i solve my marge issue as

First Way:

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

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

php bin/magento config:set dev/js/merge_files 1
php bin/magento config:set dev/js/minify_files 1
 

Another Way:

ENVIRONMENT CONFIGURATION

...
'js' => [
   'merge_files' => '1',
   'minify_files' => '1',
],
'css' => [
    'minify_files' => '1',
    'merge_css_files' => '1',
],
...

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

0

Use Below Command for - Disable(0) / Enable(1) from SSH/Putty/CMD.

Merge Minify JS

php bin/magento config:set dev/js/merge_files 0

php bin/magento config:set dev/js/minify_files 0

JS Bundling

php bin/magento config:set dev/js/enable_js_bundling 0

Merge Minify CSS

php bin/magento config:set dev/css/merge_css_files 0

php bin/magento config:set dev/css/minify_files 0

CSS Critical Path

php bin/magento config:set dev/css/use_css_critical_path 0

Minify HTML

php bin/magento config:set dev/template/minify_html 0

After all configuration set using above command then must run below command.

php bin/magento cache:clean
php bin/magento cache:flush

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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