I have the problem, that my external resources gets loaded after my local resources. So I can't override that styles. I have a custom theme and added a default_head_blocks.xml with the following content:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <css src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" src_type="url" />
    <css src="css/test.css" />

Generated HTML:

    <link  rel="stylesheet" type="text/css"  media="all" href="[...]/css/test.css" />
    <link  rel="stylesheet" type="text/css"  media="all" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />

How can I first load the external resources in my head section?

  • what happens if you switch those lines in the xml? i.e. put the css/tests.css line before the external source?
    – Robin
    Dec 11, 2015 at 10:02
  • Already tried that. Doesn't change anything. I think the order in the xml file is not relevant. But it's really weird if external resources always gets loaded after local resources... Dec 11, 2015 at 10:11
  • @DominikBarann have you resolve this issue?
    – LucScu
    Jul 18, 2017 at 6:55
  • @DominikBarann try to write <css src="css/test.css" media="all and (min-width: 1px)"/> and see if it helps. Atleast it helped me to put my internal themes css at the end
    – juhanix
    Dec 13, 2017 at 11:34

2 Answers 2


This issue because your module load after that module have add css file. You need add the following code in module.xml:

        <module name="Magento_Theme"/>

This tags: Load your module before Magento_Theme module.

If you installer your module, you need find order load module in path app/etc/config.php

  • hmm I don't think that's the problem because I load both css files in my custom theme. So the order of that both css files can't be a problem of another module? Dec 11, 2015 at 9:23

I have the same issue too. I notice that only if your module is the first in app/etc/config.php magento reads correctly css sequence in head section.

I think that probably, if another module with css in head section is loaded before your module, then all modules css local resources are loaded first and css external resources are loaded all togheter after for last.

Could you try this also in your store?

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.