I've a less file inside app/design/frontend//web/css/source/_test.less and included in default.xml like

    <css src="css/source/_test.css" />

It's working perfectly in developer mode but in production mode it's showing error like "

(index):1 Refused to apply style from ....

1 Answer 1


If you want to add your custom CSS you just have to declare it in that your theme layout.

XML path:


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" layout="1column">
        <css src="css/custom.css" />

Less path:


  • like that only i've created. in production mode it's not working
    – Amjad M
    Jan 2, 2019 at 15:08
  • please update your LESS _test.less to test.less & _test.css to test.css
    – Sanju
    Jan 3, 2019 at 6:08

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.