Doesn't seem to work

Nov 1, 2011 at 1:00 PM

Hi, was just testing out this module ... I've installed it and enabled the feature, but nothing seems to have changed. I have a custom Layout.cshtml in my theme which includes a number of styles using Style.Include("Foo.css") and they all just load individually as normal ...? Also all of the jQuery chunks (jquery-1.6.4.js, jquery.effects.core.js, jquery.ui.* etc.) are still loading individually. Am I missing something?

Nov 1, 2011 at 1:08 PM

Ah, here we go:

 

2011-11-01 12:52:51,266 [66] Piedone.Combinator.CombinedResourceManager - Error when combining Style files
System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
   at System.Uri..ctor(String uriString, UriKind uriKind)
   at Piedone.Combinator.CombinedResourceManager.Combine(IList`1 resources, Int32 hashCode, ResourceType type, Boolean combineCDNResources) in g:\Orchard\Default\src\Orchard.Web\Modules\Piedone.Combinator\CombinedResourceManager.cs:line 169
   at Piedone.Combinator.CombinedResourceManager.BuildRequiredResources(String stringResourceType) in g:\Orchard\Default\src\Orchard.Web\Modules\Piedone.Combinator\CombinedResourceManager.cs:line 105

Nov 1, 2011 at 1:09 PM

And also:

 

2011-11-01 12:52:51,312 [66] Piedone.Combinator.CombinedResourceManager - Error when combining JavaScript files
System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
   at System.Uri..ctor(String uriString, UriKind uriKind)
   at Piedone.Combinator.CombinedResourceManager.Combine(IList`1 resources, Int32 hashCode, ResourceType type, Boolean combineCDNResources) in g:\Orchard\Default\src\Orchard.Web\Modules\Piedone.Combinator\CombinedResourceManager.cs:line 169
   at Piedone.Combinator.CombinedResourceManager.<>c__DisplayClass6.<BuildRequiredResources>b__1(ResourceLocation location) in g:\Orchard\Default\src\Orchard.Web\Modules\Piedone.Combinator\CombinedResourceManager.cs:line 132
   at Piedone.Combinator.CombinedResourceManager.BuildRequiredResources(String stringResourceType) in g:\Orchard\Default\src\Orchard.Web\Modules\Piedone.Combinator\CombinedResourceManager.cs:line 143

Nov 1, 2011 at 1:20 PM

Ok ... I've fixed it by setting the BaseUrl in my development site's settings. But you probably don't want to assume the setting will have a value, and it's not really needed anyway. There are various other ways of getting an absolute Url for the site.

The following from RoutePartDriver:

            var request = _httpContextAccessor.Current().Request;
            var containerUrl = new UriBuilder(request.ToRootUrlString()) { Path = (request.ApplicationPath ?? "").TrimEnd('/') + "/" + (part.GetContainerPath() ?? "") };

There might be better ways; I've seen it done with two or three different methods, I had a look for more examples but couldn't find any quickly.

Otherwise, you could always raise an error if the setting is missing (as Warmup does); but actually, that setting is used in very little places in Orchard and it might be best to avoid.

Just another note: not sure if you're aware, but you don't need to use the [OrchardFeature(...)] attribute on the "default" feature of a module. You only need it on additional features.

Coordinator
Nov 1, 2011 at 3:13 PM
Edited Nov 1, 2011 at 7:31 PM

The code indeed relies on the BaseUrl setting, I've thought it's mandatory anyway. But thank you very much, I'll look into this.

Yes, I know that the OrchardFeature attribute is not mandatory, but it's my habit to add it anyway to clearly distinguish between the sources needed for specific features. Even, if there is only one feature: there may be more.

Nov 1, 2011 at 3:28 PM

It's only mandatory if you're using Warmup module, and the only other place it gets surfaced is in the RoutePart UI. I'm not using RoutePart; I wrote my own routing system for Mechanics. (Actually, you might be interested; it composes Urls based on relationships, which is perfect for instance for building page hierarchies...)

Coordinator
Nov 1, 2011 at 8:31 PM

Could you please take a look at the latest changeset (bb500601a4e2). This should be fixed.