How to Merge CSS and JavaScript in Magento 2
How To
How to Merge CSS and JavaScript in Magento 2

How to Enable Merge CSS, JavaScript in Magento 2

Why merge CSS and JavaScript in Magento 2

Merging all individual CSS and JavaScript files into one single condensed file will helps optimize your site by reduce the number of requests to your server and improve your page loading time.

How to merge CSS and JavaScript in Magento 2

Magento 2 - Merge CSS and JavaScript

In Magento 2.2.x and 2.3.x
bin/magento config:set dev/css/merge_css_files 1
bin/magento cache:clean
In Magento 2.0.x and 2.1.x
UPDATE core_config_data SET value = 1 WHERE path = 'dev/css/merge_css_files';
Using n98-magerun2 for Magento 2.1.x, 2.2.x and 2.3.x
n98-magerun2.phar config:store:set dev/css/merge_css_files 1
n98-magerun2.phar cache:clean
Environment configuration
...
'js' => [
   'merge_files' => '1',
   'minify_files' => '1',
],
'css' => [
    'minify_files' => '1',
    'merge_css_files' => '1',
],
...
Related

Magento 2 Extensions

Get more from your Magento2 store!

Enhanced Transactional Emails

Get more from your order confirmation emails by promoting other complementary products.

Enhanced Success Page

Add cross-sell, upsell, related products, social media links and other elements to your order confirmation.

Order Shipment Tracking

Providing your customer with a beautiful and functional order package tracking without leaving your site.