Skip to content

setup:static-content:deploy fails with errors which makes no sense #32075

Closed
@Eddcapone

Description

@Eddcapone

Preconditions (*)

  1. 2.4.1 (i had this bug with any version since I started with magento 2)

Steps to reproduce (*)

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:

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; 

Expected result (*)

It should compile without errors

Actual result (*)

It throws errors.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions