I’m trying to override some css from one of the installed modules (in this case AdvancedSearch). I can’t override by making it more specific and I would rather not rely on the !important tag to accomplish this. Unfortunately the import statement for the theme is rendered above that of the module and so the module css overrides the theme css rather than the other way round.
How can I swap the render order for these?
You can edit the theme’s view/layout/layout.phtml to change the order things are loaded in.
Simplest way to get the theme CSS loaded last would be to move it after the line that modules often use to add their styles:
$this->trigger('view.layout');
The line that loads the theme CSS often uses prependStylesheet, like this:
$this->headLink()->prependStylesheet($this->assetUrl('css/style.css'));
You’d want to switch that to use appendStylesheet instead also.
2 Likes
Thanks! That’s exactly what I needed.