Magento child theme style-m.less, etc not found

Magento child theme style-m.less, etc not found

September 17, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento child theme style-m.less, etc not found

Debugging Magento Child Theme Compilation Issues

Hello developers! Today we’re going to tackle a common issue that arises when creating child themes for Magento 2: the dreaded “not found” errors for style-m.less and style-l.less files.

Understanding the Problem

So you’ve created your child theme based on the Blank theme, and you have only two files in your CSS source folder - _extend.less and lib/variables/_colors.less. You expect Magento to pull all the other styles from the parent theme during compilation. But when you try to access /MyTheme/en_US/css/styles-m.css or /MyTheme/en_US/css/styles-l.css, it’s saying they can’t be found.

What’s Happening Under the Hood

Let’s take a step back and understand what Magento is doing behind the scenes during this process:

  1. Theme Compilation: When you run bin/magento setup:static-content:deploy, Magento compiles all your theme files - LESS, CSS, JavaScript, etc.

  2. Merge Process: The compiler takes your child theme’s LESS files and merges them with the parent theme’s styles using the Lessphp library.

  3. Output Files: The compiled output is then stored in pub/static/frontend/yourtheme/en_US/css for the minified version (styles-m.css) and pub/static/frontend/yourtheme/en_US/css/src for the unminified version (styles-l.css).

Troubleshooting Your Issue

Step 1: Check Your Child Theme Structure

Ensure that your child theme is properly structured. The CSS source folder should look like this:

web/
└── css
    └── source
        ├── _extend.less
        ├── lib
        │   └── variables
        │       └── _colors.less

Step 2: Verify Your Parent Theme

Ensure that your parent theme (in this case, Blank) is installed and enabled correctly.

Step 3: Examine the Compile Process

Run bin/magento setup:static-content:deploy with verbose output:

php bin/magento setup:static-content:deploy --all --verbose

This will give you a detailed log of the compile process. Look for any errors or warnings related to your child theme.

Step 4: Clean Cache and Generated Files

You mentioned clearing the cache and removing files from pub/static and var/view_preprocessed. That’s correct! Make sure you run these commands:

php bin/magento cache:clean
rm -rf var/view_preprocessed/*

# If using file system maintenance mode:
bin/magento setup:maintenance:mode disable

Step 5: Check Lessphp Configuration

Lessphp is the library Magento uses for LESS compilation. Ensure it’s properly configured in your project. You can find its configuration details in the Magento documentation.

Common Mistakes to Avoid

Don’t Delete _theme.less

While it’s true that _theme.less is only used for specifying the parent theme, you shouldn’t delete it unless you have a clear reason. It helps maintain the child theme structure.

Use @import Instead of Copying Files

Rather than copying over all the LESS files from the parent theme to your child theme, use @import statements in your _extend.less file to pull what you need. This keeps your child theme lightweight and manageable.

Conclusion: Get Your Child Theme Compiling Again

In most cases, these issues are caused by a misconfiguration or missing file during the compile process. The key is to check the verbose output of the compilation command for any errors or warnings.

If you’re still having trouble, don’t hesitate to reach out to our professional Magento support team at Laravel Company. We’ve helped countless developers resolve complex theme compilation issues.

Remember, Magento 2’s theming system can be challenging at first, but with patience and a solid understanding of the process, you’ll be creating stunning child themes in no time!

Happy coding!

Magento 2 Themes Deployment Errors

Our network