How to create new *.less file in Magento 2.3 project ?

Here is my existing Theme:

enter image description here

enter image description here

Here is my existing less file that DOES NOT work:

enter image description here

Nothing is work here:

enter image description here

enter image description here

My question is how to add custom less code/file to custom Theme?

any help would be extremely appreciated.

2 Answers 2


You have created the less file properly,

Run the Below command and check: (If grunt is installed properly, then your changes will reflect)

grunt refresh 
grunt less:YourThemeName
  • arrgh you are right, voted yours as answer Commented May 10, 2019 at 6:04
  • This Answer is not valid for our question, @YusufIbrahim why my answer is not acceptable for this question. Commented May 10, 2019 at 9:26
  • @Abrar Pathan, My answer is correct as per the default magento. Also your answer is right, but we used that less file on module basis. Commented May 10, 2019 at 9:38
  • @AbrarPathan actually _extend.less works in both "Magento_Theme\web\css\source" and "app/design/frontend/Senheng/default/web/css/source/", my mistake is I do not run "grunt refresh" before. but yes your anwer provide me more information for debugging Commented May 10, 2019 at 9:39
  • @YusufIbrahim as per your question is not this issue is not Grunt related. Also, I can see your screenshot your grunt is working fine. In short, my answer is acceptble for this question. I think you are just asking the questions to make points on stack Commented May 10, 2019 at 9:47

I have a review your question and I found that you have done the wrong step to override _extend.less file.

The correct way to override _extend.less file:

Go in your theme Magento_Theme\web\css\source create _extend.less and put your changes in that.


  • hi, thank mate, that's right.. you save my day :) Commented May 10, 2019 at 5:46

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.