I have created a custom theme, for the listing page i have created custom less file,

app\design\frontend\Zero\my_theme\Magento_Catalog\web\css\source\ _custom_listing_page.less

On the Website listing page my _custom_listing_page.less not working. which means not compiled into CSS file.

I have declared my _custom_listing_page.less in app\design\frontend\Zero\sleepworld\my_theme\layout\catalog_category_view.xml

   <css src="Magento_Catalog::css/source/_custom_listing_page.css" rel="stylesheet" type="text/css" />

Console error - CSS file : canceled

enter image description here

Note : Local working good, when i move to live then i am getting the error.


1 Answer 1


Your catalog_category_view.xml should be something like this;

   <css src="Magento_Catalog::css/custom_listing_page.css" rel="stylesheet" type="text/css" />
  • But i created with underscore right "_custom_listing_page.less", should i remove in xml file?
    – zus
    Feb 13, 2021 at 13:51
  • Its better to rename the custom less file without underscore. Because _ means these files will be used main wrapper less file and imported in. Feb 13, 2021 at 14:03
  • Understood your point, let me remove that, before i will ask one query, in localhost everything good, less compiled to css everything good, when i move to the live server there i am getting an error, any specific reason for this.
    – zus
    Feb 13, 2021 at 14:13

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.