I created a custom less file in


I don't know how to compile it and how to imports this file in style-l.css

please give your suggestions

  • create in theme module Commented Sep 25, 2017 at 5:08
  • let me know if any problem Commented Sep 25, 2017 at 5:16

2 Answers 2


For custom less use _extend.less this will import all your style in style-l.css

Create _extend.less and place at below location in your extended theme module


After adding your less styles here , run following commands to compile it to style-l.css

In developer mode

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

In Production Mode

php bin/magento setup:upgrade

php bin/magento deploy:mode:set production

Keep your cache disabled or flush your cache

  • does it help you ? Commented Oct 16, 2017 at 11:38

Place your custom css in your-theme/web/css and add your css in


before styles-m.css like

<css src="css/custom.css" media="screen and (min-width: 1px)"/>

and then deploy the static content

also on the developer mode to avoid to deploy the content again and again

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.