LESS File Is Empty Error During CSS Generation with Pearl Theme
Problem
When running php bin/magento weltpixel:css:generate (or php bin/magento weltpixel:less:generate), the process fails with an error similar to:
Compilation from source: LESS file is empty:
frontend/Pearl/weltpixel_custom/en_GB/WeltPixel_CategoryPage/css/weltpixel_category_store_default.less
This error typically appears after one or more of the following:
- Migrating from a manual (SSH/
app/code,app/design) installation to a Composer-based installation - Switching the active storefront theme to Pearl or a Pearl child theme
- Setting up a store view with a non-default locale (e.g.,
en_GB)
The root cause is that certain WeltPixel modules generate store-specific LESS files dynamically (for example, weltpixel_category_store_STORECODE.less). These files are created when module settings are saved in the Magento admin or when the LESS generation command is run. If they have never been generated for a given store view — or if generated files were removed during a migration — they will be empty or missing, causing compilation to fail.
Solution
Follow the steps below in order.
Step 1 — Ensure the Pearl base theme is installed via Composer
If you migrated from a manual installation and removed files from app/code or app/design, confirm the Pearl base theme is present as a Composer package:
composer require weltpixel/m2-theme-frontend-weltpixel
Important: If you maintain a custom child theme inapp/design/frontend/Pearl/weltpixel_custom, do not also installweltpixel/m2-theme-frontend-weltpixel-customvia Composer. Having the same theme registered in both locations causes a duplicate theme definition error. Choose one location only.
Step 2 — Regenerate store-specific LESS files via Magento admin
This is the most reliable way to populate the empty store-specific LESS files:
- Log in to the Magento admin panel.
- Navigate to Stores > Configuration and open each of the following sections for your affected store view. Re-save the settings (no changes required — saving alone triggers LESS regeneration):
- WeltPixel > Category Page settings
- WeltPixel > Product Page settings
- WeltPixel > Frontend Options settings
- WeltPixel > Custom Header settings
- WeltPixel > Custom Footer settings
- After saving, navigate to System > Cache Management > WeltPixel Cache Management and click Re-Generate Pearl Theme LESS/CSS.
Alternatively, you can trigger LESS regeneration for all covered modules at once via CLI:
php bin/magento weltpixel:less:generate
Step 3 — Clear generated and static files
Remove stale generated files to ensure a clean compilation:
rm -rf generated/*
rm -rf pub/static/*
rm -rf var/view_preprocessed/*
Step 4 — Run the standard Magento deployment sequence
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f en_GB en_US
php bin/magento cache:flush
Replace en_GB en_US with the locales used by your store views.
Step 5 — Regenerate WeltPixel CSS
php bin/magento weltpixel:css:generate --store=STORECODE
Replace STORECODE with your actual store code (e.g., default). Run this command once per store view that uses the Pearl theme.
Step 6 — Re-save theme and layout configuration in admin
If Luma or another parent theme's styles continue to appear after compilation, force Magento to refresh its design configuration:
- Go to Content > Design > Configuration.
- Click Edit for the affected store view and re-save without making changes.
- Return to Stores > Configuration and re-save the WeltPixel > Category Page settings, paying particular attention to category display layout options (e.g., Full Width, One Column).
- Flush the cache:
php bin/magento cache:flush
Verification
The fix is successful when:
php bin/magento weltpixel:css:generate --store=STORECODEcompletes without anyLESS file is emptyerrors.- The storefront displays Pearl theme styling with no Luma fallback styles visible.
- Store-specific LESS files (e.g.,
weltpixel_category_store_default.less) are no longer empty — you can confirm by checking the file size inside the relevant module'sview/frontend/web/css/directory.
Updated on: 09/03/2026
Thank you!