0

I need to load the css file THEME\Magento_Checkout\web\css\checkout\index\index.css in the checkout page only.

So I created the file THEME\Magento_Checkout\layout\checkout_index_index.xml and added a layout instruction:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Magento_Checkout::css/checkout/index/index.css"/>
    </head>
</page>

I can see in the source code that it tries to load the script, but if I open it then I get

Compilation from source: LESS file is empty: frontend/company/base/de_DE/css/checkout/index/index.less

0

I solved it by executing grunt clean. Now after loading the source code site again, it shows

https://example.com/pub/static/version1584630764/frontend/company/base/de_DE/Magento_Checkout/css/checkout/index/index.css"

instead of

https://example.com/pub/static/version1584630764/frontend/company/base/de_DE/css/checkout/index/index.css"

and it works.


Hint: If you don't use grunt, then you will have to manually delete the folders pub/static/frontend and var/view_preprocessed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.