Is it possible to remove already required and included resources with resourceManager

Topics: Customizing Orchard
Feb 18, 2014 at 4:36 PM
I am trying to implement a module which brings new content part / type and widget which uses lots of third-party frameworks and libraries (AngularJS, Bootstrap + some other javascript libraries and etc). The goal I want to achieve is that I want to make the module theme independent or in other words I want my module to look the same no matter of the installed theme that is applied to Orchard system. For example I find some problems when the user is using Bootstrap / Bootswatch theme (the styles got messy overriding each other).

In my part display view I am trying the following approach:
var resourceManager = WorkContext.Resolve<IResourceManager>();
var requiredStyles = resourceManager.GetRequiredResources("stylesheet");

    foreach (RequireSettings setting in requiredStyles)
    {
        if (setting.Name == "BootswatchStyle" || setting.Name == "CustomStyle")
        {
            requiredStyles.ToList().Remove(setting);
        }
    }
and then loading all the needed resources for my module
 Script.Require("MyScripts");
 Style.Require("MyStyles");