Making a stylesheet come last (depend on unknown dependencies)

Topics: Customizing Orchard, General, Writing themes
Nov 1, 2015 at 10:29 PM
In order to style things, I generally put default styles for things in the module's stylesheet, and then use the theme to override those styles. In order for this to work my theme's stylesheet would have to come last (after any modules that i'm overriding styles for).

I understand that when stylesheets use ResourceManifest and they are set up to hold dependencies on other stylesheets, they will appear later in the generated HTML.

But in my case I don't know what modules will exist and even if I did I don't think it's right to make my theme depend on every module i'm overriding styles for. I just want my stylesheet to come last.

Is there a way to do that?
Nov 2, 2015 at 11:55 AM
You could do Style.Require("MyStyles").AtFoot()
Nov 2, 2015 at 6:19 PM
Actually I don't think that works, AtFoot() is only respected for scripts, as can be seen from this file:

        var head = ctx.Layout.Head;
        var tail = ctx.Layout.Tail;
I ended up writing my own subclass of ResourceManager that triggers an event after BuildRequiredResources and plays around with the list at that point in time.