0

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

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

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

1

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

XML path:

app/design/frontend/YourTheme/default/Magento_Theme/layout/default_head_blocks.xml

<?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">
    <head>
        <css src="css/custom.css" />
    </head>
</page>

Less path:

app/design/frontend/YourTheme/default/web/css/custom.less

2
  • like that only i've created. in production mode it's not working
    – Amjad M
    Commented Jan 2, 2019 at 15:08
  • please update your LESS _test.less to test.less & _test.css to test.css
    – Sanju
    Commented 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.