Issues with the ResourceManifest.cs

Topics: Customizing Orchard
Jun 25, 2013 at 7:35 PM
Edited Jun 25, 2013 at 7:36 PM
I am trying to include some of my JS and CSS Files in the ResourceManifest, but I am running into quite some issue:

THis is how my ResourceManifest.cs looks like:
using Orchard.UI.Resources;

namespace Themes.TheClubWTheme 
{
  public class ResourceManifest : IResourceManifestProvider
  {
    public void BuildManifest(ResourceManifestBuilder builder)
  {

     var manifest = builder.Add();

     manifest.DefineStyle("Foundation").SetUrl("foundation.min.css");
     manifest.DefineScript("FoundationScript").SetUrl("foundation.min.js");

    }
  }
}
and in the Layout.cshtml, I have following:
@{
  Script.Require("ShapesBase");
  Script.Require("FoundationScript");

 Style.Include("site.css");
 Style.Require("Foundation"); 
}

Whenever I try to run the code, I'm getting following error:

A 'script' named 'FoundationScript' could not be found.

any ideas?
Developer
Jun 25, 2013 at 7:39 PM
Edited Jun 25, 2013 at 7:39 PM
Your theme needs to be a in a separate project with a separate .csproj file if you want to use code other than just Razor files. Just like any other module, but with Theme.txt instead of Module.txt manifest.
Jun 25, 2013 at 7:40 PM
Its actually inside the Themes Folder (generated with the command-line tool).
Developer
Jun 25, 2013 at 7:44 PM
Edited Jun 25, 2013 at 7:45 PM
That's exactly the reason.

You should use the /CreateProject switch when generating a theme - codegen theme YourThemeName /CreateProject:true.
Re-run the command, put all your files under the newly created project and you're good.
Jun 25, 2013 at 8:03 PM
Just did this - Still, the issue exists.:(
Developer
Jun 25, 2013 at 8:06 PM
Have you added it to your solution and rebuilt from Visual Studio? If you haven't, it won't work.
Jun 25, 2013 at 8:14 PM
Edited Jun 25, 2013 at 8:20 PM
I see, thank you! :)
Still trying to adjust from my Rails Background to the .NET Stuff.

It seems that it finally loads up my ResourceManifest.cs - but now it tells me following - complaining about a missing implementation, while I actually do have it in the code.

'TheClubWTheme.ResourceManifest' does not implement interface member 'Orchard.UI.Resources.IResourceManifestProvider.BuildManifests(Orchard.UI.Resources.ResourceManifestBuilder)' C:\Orchard.Source\src\Orchard.Web\Themes\TheClubWTheme\ResourceManifest.cs

Edit: Just noticed the Typo.Let's see how that works now.
Developer
Jun 25, 2013 at 8:18 PM
Np, glad I could help:)

Seems like you have a typo - the method is BuildManifests, not BuildManifest.
Jun 25, 2013 at 8:20 PM
Yep - just noticed that at the same time, by actually looking at your Bootstrap Theme.

Thank you, it works perfectly fine now :)