Can't add javascript files in Orchard CMS's theme

Topics: Customizing Orchard
Nov 11, 2013 at 4:44 AM
Edited Nov 11, 2013 at 6:05 AM
Hi everyone,

i was building a new theme, i would like to add some javascript files to my theme but error: "GET http://localhost:30321/OrchardLocal/Themes/Metro/scripts/jquery.widget.min.js 404 (Not Found) " . I think by default, Orchard restricted both Script and Style Folders so what do you think about it ?. I tried to some ways, example:
  • Include redirectly URL to Layout.cshtml
@using (Script.Head()) {
          <script src="@Url.Content("~/OrchardLocal/Themes/Metro/Scripts/metro-js/js/jquery/jquery.widget.min.js")" type="text/javascript"></script>
  • Create a ResourceManifest.cs file in My Theme
using Orchard.UI.Resources;

namespace MetroThemeMannifest
    class ResourceManifestThemeMetro : IResourceManifestProvider 
        public void BuildManifests(ResourceManifestBuilder builder)
            var manifest = builder.Add();
In your view, include the script and style like this:
@using(Script.Foot()) { Script.Include("jQueryWidget");
Thank you very much.

Nov 11, 2013 at 7:18 AM
I think you're just missing a web.config file in your scripts folder.
Nov 11, 2013 at 9:06 AM
Edited Nov 11, 2013 at 9:19 AM
Hi BertranLeRoy,

exactly, i checked. have i do with Scripts/web.config file to include or require javascript files ?

I created Themes/ResuorceManifest.cs file/ but when i include so it not found that file, when i require so it A 'script' named 'jQueryWidget' could not be found.

How i fix it ?

Thank you.
Nov 11, 2013 at 10:02 AM
Hi BertrandLeRoy,

I recently recognize when i use to @{ Script.Require() }, namespace is /OrchardLocal/Modules/Orchard.jQuery/scripts/metro/jquery.widget.min.js. As you see that, how to change that namespace ?
Nov 12, 2013 at 1:11 AM
You don't need a resource manifest from a theme. Use Script.Include instead.
Nov 12, 2013 at 3:21 AM
Thank you BertrandLeRoy, ^_^

i fixed success because of missing /Scripts/web.config so i can't use to Script.Include().
Marked as answer by phuochuy on 11/11/2013 at 7:21 PM