I want to add the custom.less file in my custom theme which i want to develop from scratch.

so, anyone have an idea then please share with me.

1 Answer 1

  1. Let’s assume that you have created custom theme. Now, Create your custom less file and add your less code inside that file.


  2. After that you need to import this _custom.less file


@import '_custom.less';

You need to import your _custom.less file using this above line. Just add that line inside _sources.less file. If this _sources.less file not exist in your custom theme then, you need to copy file from vendor/magento/theme-frontend-blank/web/css/source/_sources.less file in your theme.

Now, just need to deploy and clean cache.

php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:c
  • Thank you for response.
    – Deep Shah
    Commented May 10, 2022 at 6:44

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.