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">
        <css src="css/home.css" />

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.


did you try the full path of less file?

| improve this answer | |
  • 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 Mar 22 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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