Question

If I execute php bin/magento setup:static-content:deploy then I get alot of errors like:

Compilation from source: /home/company/staging.company.de/app/design/frontend/company/fresh/web/css/source/_mixins/fx.less
variable @theme__color__primary is undefined in file /home/company/staging.company.de/var/view_preprocessed/pub/static/frontend/company/fresh/de_DE/css/source/_mixins/fx.less in fx.less on line 3, column 12
1| .link_hover {
2|     cursor: pointer;
3|     color: @theme__color__primary;
4|     text-decoration: underline;
5|     text-decoration-color: @theme__color__primary;
6| }

It says that @theme__color__primary is undefined in the file fx.less, so I checked if that is true but it is not true!

This is my _extend.less file:

// Variables
@import 'lib/extend/variables/_layout';
@import 'lib/extend/variables/_colors';

@import '_variables/elements/button';
@import '_variables/responsive';
@import '_variables/icons';
@import '_variables/colors';                     // <-- @theme__color__primary is defined here
@import '_variables/header';
@import '_variables/typographie';
    // Extensions
    @import '_variables/amasty/checkout';

// Mixins
@import '_mixins/fonts';
@import '_mixins/fx';                            // <-- Error is getting thrown here
@import '_mixins/elements/button';

As you can see, the file _variables/colors.less which contains the variable is loaded before _mixins/fx.less, so why is the error thrown?

_variables/colors.less

@defaultBackgroundColor: #EFF1F2;
@color-company-orange-alt: #FF7712;
@theme__color__primary: @color-company-orange-alt; 
Was it helpful?

Solution

The problem is with the filenames. You have to rename all .less files and put an underscore _ as prefix.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top