> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.weltpixel.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to minify, merge, bundle of HTML / CSS / JS - Magento Cloud vs. Magento Admin

Magento offers a few ways to control **minification, merging, and bundling** for HTML, CSS, and JavaScript. The approach differs between **Magento Commerce Cloud** and a standard install configured via the **Magento Admin**.

---

## 1) Configure HTML/CSS/JS on Magento Commerce Cloud (ECE/B2B)

On Cloud, these settings are committed as configuration rather than toggled only in the Admin.

### Step 1 — Export environment configuration
From the root of your Magento ECE project (over SSH):

```bash
php vendor/bin/m2-ece-scd-dump
```

This exports environment config to `app/etc/config.php`.

> Need more details? See Magento Cloud docs on exporting store settings.

### Step 2 — Edit `app/etc/config.php`
Add or adjust the relevant **dev** keys. Use **1** to enable and **0** to disable.

> **Note on JS merge:** If you enable `merge_files` for JS, also enable **JS bundling** or the files won’t merge into a single bundle.

```php
'dev' =>
array (
    'static' =>
    array (
        'sign' => '1',
    ),
    'front_end_development_workflow' =>
    array (
        'type' => 'server_side_compilation',
    ),
    'template' =>
    array (
        'minify_html' => '0',
    ),
    'js' =>
    array (
        'merge_files' => '1',
        'minify_files' => '1',
        'enable_js_bundling' => '1',
        'minify_exclude' => '/tiny_mce/',
        'session_storage_logging' => '0',
        'translate_strategy' => 'dictionary',
    ),
    'css' =>
    array (
        'minify_files' => '1',
        'merge_css_files' => '1',
        'minify_exclude' => '/tiny_mce/',
    ),
),
```

![magento-cloud-config-php-example.png](https://storage.crisp.chat/users/helpdesk/website/-/8/f/7/f/8f7f5fdf36392800/27349f60-4671-40eb-bd34-4c88fc_1hxm343.png)

### Step 3 — Commit, push, and redeploy
After committing to your Cloud Git repo, clear caches and redeploy static content:

```bash
php bin/magento cache:clean
php bin/magento cache:flush
rm -Rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/
php bin/magento setup:static-content:deploy -f
```

**Performance tip:** Always test. Bundling can reduce requests, but on HTTP/2 it may increase **Start Render** and **DOM Content Loaded** times.

Test here: https://www.webpagetest.org

![webpagetest-results-cloud.png](https://storage.crisp.chat/users/helpdesk/website/-/7/1/6/f/716fce7f01c39400/f2d97620-17e7-4680-a0d6-16de1f_1ki14rw.png)

---

## 2) Configure HTML/CSS/JS from Magento Admin (Developer Mode)
These options are visible in **Developer** mode:

**Path:** `Stores -> Configuration -> Advanced -> Developer -> CSS Settings / JavaScript Settings`

![magento-admin-developer-css-js-settings.png](https://storage.crisp.chat/users/helpdesk/website/-/4/4/f/3/44f30b5fe4ae1800/ed3ee35a-900c-4df0-9c02-1049c6_15mi2zs.png)

After saving, clear caches and redeploy static content:

```bash
php bin/magento cache:clean
php bin/magento cache:flush
rm -Rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/
php bin/magento setup:static-content:deploy -f
```

Again, validate with a speed test and watch **render** timings:

![webpagetest-results-admin.png](https://storage.crisp.chat/users/helpdesk/website/-/4/e/5/f/4e5fab1b62244000/c119e48c-e4d0-46d0-a438-a76e41_e907fq.png)

---

### Quick guidance
- **Cloud:** Set values in `app/etc/config.php`, commit, and deploy.
- **Standard installs:** Toggle in Admin (Developer mode), then deploy static content.
- **HTTP/2 note:** Prefer **minification** over heavy **bundling**; bundle only if real-world tests show improvements.