Magento 2 - Grunt watch not detecting changes of _extend.less
-
11-04-2021 - |
Domanda
I have these files:
THEME = app\design\frontend\company\base
THEME\web\css\source\lib\extend\variables\_typography.less
THEME\web\css\source\lib\extend\variables\_colors.less
THEME\web\css\source\_extend.less
This is my THEME\web\css\source\_extend.less:
@import 'lib/extend/variables/_colors';
@import 'lib/extend/variables/_typography';
a { color: @theme__color__primary-alt; }
If I make changes in THEME\web\css\source\lib\extend\variables\_colors.less or THEME\web\css\source\lib\extend\variables\_colors.less then they are detected by "grunt watch", but if I modify _extend.less then "grunt watch" does not react at all.
What might be the cause?
Soluzione
It looks like we are not supposed to add code lines into this file other than imports. There must be an exclude in the grunt watch command.
So I created a new file THEME\web\css\source\lib\extend\variables\_test.less and imported it and moved my changes to it.
THEME\web\css\source\_extend.less:
@import 'lib/extend/variables/_colors';
@import 'lib/extend/variables/_typography';
@import 'lib/extend/variables/_test';
THEME\web\css\source\lib\extend\variables\_test.less
a { color: @theme__color__primary-alt; }