Skip to main content
added 2 characters in body; edited title
Source Link

Using LESS Variablesvariables in extended LESS file Magento 2

I need to use LESS Variables in my extended LESS file in my theme.

I've this code in my _extend.less in this location My_Magento\app\design\frontend\<My_Vendor>\<My_Theme>\web\i18n\fa_IR\css\source\_extend.less :

@import '_rtl.less';

and in the _rtl.less file:

.myClass{
    background: @color_theme;
}

Note that the @color_theme defined in the Parent Theme in this location My_Magento\app\design\frontend\<Parent_Vendor>\<Parent_Theme>\web\css\_general.less

So when I run:

php bin/magento setup:static-content:deploy

It will Throwthrow some errors like this:

variable @color_theme is undefined in file C:/xampp7/htdocs/My_Magento/var/view_preprocessed/css/frontend/<My_Vendor>/<My_Theme>/fa_IR/css/source/_rtl.less in _rtl.less on line 20, column 15

It will happens for any variable of any LESS Styles included in Parent Theme or Modules etc. in my _extend.less theme file!

How can I use LESS Variables from other sources (Parent Theme or Modules LESS files) in my _extend.less file?

I'm using Magento 2.1.9 with PHP 7.0.22 and XAMPP 3.2.2. Thanks

Thanks.

Using LESS Variables in extended LESS file Magento 2

I need to use LESS Variables in my extended LESS file in my theme.

I've this code in my _extend.less in this location My_Magento\app\design\frontend\<My_Vendor>\<My_Theme>\web\i18n\fa_IR\css\source\_extend.less :

@import '_rtl.less';

and in the _rtl.less file:

.myClass{
    background: @color_theme;
}

Note that the @color_theme defined in the Parent Theme in this location My_Magento\app\design\frontend\<Parent_Vendor>\<Parent_Theme>\web\css\_general.less

So when I run:

php bin/magento setup:static-content:deploy

It will Throw some errors like this:

variable @color_theme is undefined in file C:/xampp7/htdocs/My_Magento/var/view_preprocessed/css/frontend/<My_Vendor>/<My_Theme>/fa_IR/css/source/_rtl.less in _rtl.less on line 20, column 15

It will happens for any variable of any LESS Styles included in Parent Theme or Modules etc. in my _extend.less theme file!

How can I use LESS Variables from other sources (Parent Theme or Modules LESS files) in my _extend.less file?

I'm using Magento 2.1.9 with PHP 7.0.22 and XAMPP 3.2.2. Thanks.

Using LESS variables in extended LESS file Magento 2

I need to use LESS Variables in my extended LESS file in my theme.

I've this code in my _extend.less in this location My_Magento\app\design\frontend\<My_Vendor>\<My_Theme>\web\i18n\fa_IR\css\source\_extend.less :

@import '_rtl.less';

and in the _rtl.less file:

.myClass{
    background: @color_theme;
}

Note that the @color_theme defined in the Parent Theme in this location My_Magento\app\design\frontend\<Parent_Vendor>\<Parent_Theme>\web\css\_general.less

So when I run:

php bin/magento setup:static-content:deploy

It will throw some errors like this:

variable @color_theme is undefined in file C:/xampp7/htdocs/My_Magento/var/view_preprocessed/css/frontend/<My_Vendor>/<My_Theme>/fa_IR/css/source/_rtl.less in _rtl.less on line 20, column 15

It will happens for any variable of any LESS Styles included in Parent Theme or Modules etc. in my _extend.less theme file!

How can I use LESS Variables from other sources (Parent Theme or Modules LESS files) in my _extend.less file?

I'm using Magento 2.1.9 with PHP 7.0.22 and XAMPP 3.2.2.

Thanks.

Source Link

Using LESS Variables in extended LESS file Magento 2

I need to use LESS Variables in my extended LESS file in my theme.

I've this code in my _extend.less in this location My_Magento\app\design\frontend\<My_Vendor>\<My_Theme>\web\i18n\fa_IR\css\source\_extend.less :

@import '_rtl.less';

and in the _rtl.less file:

.myClass{
    background: @color_theme;
}

Note that the @color_theme defined in the Parent Theme in this location My_Magento\app\design\frontend\<Parent_Vendor>\<Parent_Theme>\web\css\_general.less

So when I run:

php bin/magento setup:static-content:deploy

It will Throw some errors like this:

variable @color_theme is undefined in file C:/xampp7/htdocs/My_Magento/var/view_preprocessed/css/frontend/<My_Vendor>/<My_Theme>/fa_IR/css/source/_rtl.less in _rtl.less on line 20, column 15

It will happens for any variable of any LESS Styles included in Parent Theme or Modules etc. in my _extend.less theme file!

How can I use LESS Variables from other sources (Parent Theme or Modules LESS files) in my _extend.less file?

I'm using Magento 2.1.9 with PHP 7.0.22 and XAMPP 3.2.2. Thanks.