I'm trying to add a new less file into an already existing theme, which will turn the price classes descended from the special-price class red, highlighting a 'discount' and making it more obvious

.special-price .price {
    color: red !important;

This is in a file called _special_price.less, which is imported into the _extend.less file.

@import '_special_price.less';

It is my understanding that _extend is compiled last, which means any existing CSS is overwritten, but this doesn't seem to be happening, as the expected change is absent.

Yes, I realize that !important shouldn't be needed, but it didn't even work anyway.

I have flushed and cleaned the cache, compiled, deployed, anything I can think of. Can anyone help?


After more experiments, I have concluded that the whole CSS file in the custom theme is not even being compiled. changes to existing (and working) .less files produce no change, as when the webpage is inspected, the previous CSS is still there.

  • In which location are you create '_special_price.less' ? Commented Dec 17, 2019 at 5:10
  • in the web/css/source folder structure. Commented Dec 17, 2019 at 21:35

1 Answer 1


You can import less in following way.

_extend.less is availble in following path app/design/frontend/<vendor name>/<theme name>/web/css/source/_extend.less

You have to write in _extend.less file

@import 'special_price.less';

After adding changes run below commands.

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy -f

php bin/magento cache:clean
  • I have tried this way, and after inspecting the resulting web-page, I found no change. Commented Dec 11, 2019 at 18:44
  • You can review Sample less theme on github. github.com/vrajeshkpatel/V4U-Samplelesstheme Commented Dec 12, 2019 at 10:44
  • If mode is set to developer bin/magento c:c is enough for theme changes. Commented Dec 16, 2019 at 20:48

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.