magento 2.4.6 styles overide issue

34 views Asked by At

I have a magento 2.4 theme which defines its css using a styles-m.less file

app/design/frontend/Vendor/theme/web/css/styles-m.less

There is also a source subdirectory, with different .less files per module : ex:

app/design/frontend/Vendor/theme/web/css/source/home/_styles.less

ISSUE :

In some frontend pages (ex customer account), the generated styles-m.css is overiden by styles-l.css which seems to be generated by magento original blank theme.

I then tried:

  • copying original styles-l.less from blank theme to

    app/design/frontend/Vendor/theme/web/css/styles-l.less

  • add custom _module.less file in

    app/design/frontend/Vendor/theme/web/css/source/customer/_module.less

  • modify the styles-l.less file to import my custom customer/_module.less file

  • setup:static-content:deploy -f, flush magento cache

But it does not work. styles-l.css seems to be the same as before.

here is my custom styles-l.less file. What did I miss ?

/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

//
//  Blank theme desktop styles
//  _____________________________________________

//  These desktop styles are additional to mobile

//
//  Global lib + theme styles
//  ---------------------------------------------

@import '_styles.less';

//
//  Magento Import instructions
//  ---------------------------------------------

//@magento_import 'source/_module.less'; // Theme modules
//@magento_import 'source/_widgets.less'; // Theme widgets

//
//  Media queries collector
//  ---------------------------------------------

@import 'source/lib/_responsive.less';

@media-target: 'desktop'; // Sets target device for this file
@media-common: false; // Sets not to output common styles

//
//  Global variables override
//  ---------------------------------------------

@import 'source/_theme.less';

//
//  Extend for minor customisation
//  ---------------------------------------------

//@magento_import 'source/_extend.less';
@import 'source/customer/_module.less';
1

There are 1 answers

0
Alexglvr On

ANSWER :

  • php bin/magento setup:upgrade
  • php bin/magento setup:static-content:deploy
  • Clear cache