cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling the order of CSS files

Controlling the order of CSS files

Is there any way to ensure that my child themes CSS loads BEFORE that of it's parent theme. I'm adding the CSS file in `default_head_block.xml`.

 

There seems to be a few work arounds to make the CSS file load further down the page, but not before an existing CSS file.

 

Surely with all the configuration options magento and xml provide, there must be a way? 

 

Thanks.

2 REPLIES

Re: Controlling the order of CSS files

Hi @mattgreenfield,

 

Maybe I miss understand the problem but if you have a child theme the right behavior is to be loaded AFTER the parent theme. Right?

Isn't that the idea with hierarchy?

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Controlling the order of CSS files

Well yes, I see what you mean. I have child styles merging with parent styles in less, that makes styles.css.

 

The problem is that my child theme also wants to add a CSS file BEFORE styles.css. So that styles.css can override. Because styles.css is in the xml of my parent theme, it outputs first.

 

The odd thing for me is that we can't use 'before=""' in the xml like we can for blocks and containers. That's how I'd expect it to work anyway!