Ressource Module

Topics: Writing modules
Aug 5, 2011 at 8:23 AM

I tried to create a Ressource Module like the Jquery one.

I Added some css Styles in the RessourceManifest.

Now i want to use them in other modules, as of yet no success.

I set a breakpoint to the BuildManifests and found out that its hit, later than my "@{ Style.Require}

is this the problem maybee ?

Has anybody a hint how to resolve this issue?

 

greets

Aug 5, 2011 at 10:39 AM

Post your ResourceManifest and the code for your View - it's hard to debug without something to debug.

Aug 5, 2011 at 10:53 AM

this it the module Global

using Orchard.UI.Resources;

namespace Global.Ressources
{
    public class ResourceManifest : IResourceManifestProvider {
        public void BuildManifests(ResourceManifestBuilder builder) {
            var manifest = builder.Add();
            manifest.DefineStyle("specialcss").SetUrl("special.css");
        }
    }
}

 

this is the other module which should consume it:

DefaultView.cshtml

@using Orchard.ContentManagement;
@using Orchard.UI.Resources;
@{ Style.Require("specialcss"); }
<table>
    <tr>
        <td>

 

throws A 'stylesheet' named 'specialcss' could not be found

Aug 5, 2011 at 11:01 AM

Is special.css definitely in the Styles folder for your Global module?

Orchard.jQuery seems to set the version on all the items added to the builder, that might effect it somehow, e.g.:

manifest.DefineStyle("jQueryUI_Orchard").SetUrl("jquery-ui-1.8.11.custom.css").SetVersion("1.8.11");

Although having said that, it isn't set for the jQuery TimePicker CSS and that works.

Does your module specify your resources module as a dependency in Module.txt?

Aug 5, 2011 at 11:30 AM

okay it corrected dependencies! and never forget renaming a module after creation is veryyyyy bad !!!

 

now it works THANK YOUUU