Showing results for 
Search instead for 
Did you mean: 

Custom theme - issue with .less override


Custom theme - issue with .less override

Hello guys!
Hope for your help,
I'm very new in Magento, currently try to add my own styles for a new custom theme. In the documentation I found the next instruction:

Extend component’s styles
In your theme directory, create a web/css/source sub-directory.
Add _buttons_extend.less and _extend.less here. The path to the files looks like following:

│  ├── web/
│  │   ├── css/
│  │   │   ├── source/
│  │   │       ├──_buttons_extend.less
│  │   │       ├──_extend.less
In _buttons_extend.less add your styles for the button component.
In _extend.less register the _buttons_extend.less by adding the following code: @import '_buttons_extend.less';
But every time when I try to add _buttons_extend.less I get this error:

Completed in 6.554s at Wed Oct 21 2020 15:03:04 GMT+0300 (GMT+03:00) - Waiting...
>> File "pub\static\frontend\Custom\custom\en_US\css\source\_extend.less" changed.
Running "less:blank" (less) task
>> FileError: '_buttons_extend.less' wasn't found. Tried - pub\static\frontend\Custom\custom\en_US\css\source\_buttons_extend.less,pub\static\frontend\Custom\custom\en_US\css\_buttons_extend.less,_buttons_extend.less in pub\static\frontend\Custom\custom\en_US\css\source\_extend.less on line 1, column 1:
>> 1 @import '_buttons_extend.less';
>> 2
Warning: Error compiling pub/static/frontend/Custom/custom/en_US/css/styles-m.less Use --force to continue.

Aborted due to warnings.

Execution Time (2020-10-21 15:18:33 UTC+3)
loading tasks               101ms  █████████████████████████████████████████████████████████ 21%
loading grunt-contrib-less   85ms  ████████████████████████████████████████████████ 18%
less:blank                  295ms  ██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 61%
Total 483ms

Completed in 2.109s at Wed Oct 21 2020 15:18:34 GMT+0300 (GMT+03:00) - Waiting...

It's my folder structure:

download (1).png

What I'm doing wrong?