0

I want to add a variable that located in "web/css/source/_theme.less" to my custom less file, that I created specialy for home page. I added my less file in "Magento_CMS/layout/cms_index_index.xml"

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="css/home.css" />
    </head>
</page>

In this home file i wrote

@baseDir: '../';
@import 'source/_theme.less';
@import 'source/_home.less';

but it doesn't import variable from "_theme.less" to my "_home.less" file.

2 Answers 2

1

You can create _extend.less file in your source folder

After you import all files in _extend.less like below, Also create _variable.less and add variable in this file.

@import 'source/_theme.less';
@import 'source/_home.less';
@import 'source/_variable.less';

Hope this will help you..!

0

did you try the full path of less file?

1
  • Hello, thank you for reply. In all files that i saw (and in lib folder) import path should be written like this. Furthermore, if i delete @import 'source/_theme.less'; everything is imported in home.less
    – Herecomes
    Commented Mar 22, 2020 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.