This project is read-only.

ResourceManager Dependencies Require

Topics: General, Troubleshooting, Writing modules
Sep 19, 2011 at 11:50 AM

I declared a script and its dependencies in the ResourceManisfest.cs of my module:


manifest.DefineScript("HandleHtmlResponse").SetUrl("handle_html_response.js").SetDependencies("jQuery, jQueryPlugins_Xml");


And did the same for the jQuery plugin in the ResourceManisfest.cs of the jQuery module:


manifest.DefineScript("jQueryPlugins_Xml").SetUrl("plugins/jquery.xml/jquery.xml.js", "plugins/jquery.xml/jquery.xml.js").SetVersion("1.0.0").SetDependencies("jQuery");


I wanted to use my HandleHtmlResponse script in my page so I added at the top of my cshtml page:




I thought it would automatically add everything needed (dependencies) to use this script but in the build page the following line doesn't appear:


<script src="/OrchardLocal/Modules/Theia.jQuery/scripts/plugins/jquery.xml/jquery.xml.js" type="text/javascript"></script>

Is 'SetDependencies' not here for that? How can I get all dependencies appear in the build page without having to write all the Script.Require needed? I would like to write only Script.Require("HandleHtmlResponse") which would do the work for me.

Thanks for helping


Sep 19, 2011 at 11:13 PM

This looks like it should work. Is this getting anything included?

Sep 20, 2011 at 9:27 AM

Yes. If I write: 

then the following line is included:
<script src="/OrchardLocal/Modules/Theia.MyModule/scripts/handle_html_response.js" type="text/javascript"></script>


Sep 21, 2011 at 5:05 AM

Maybe the dependencies are not registered in the right order?