Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute url instead of relative url #182

Open
merijng opened this issue Mar 17, 2023 · 1 comment
Open

Absolute url instead of relative url #182

merijng opened this issue Mar 17, 2023 · 1 comment

Comments

@merijng
Copy link

merijng commented Mar 17, 2023

See a previous issue regarding absolute url's

Smidge version: 4.1.0

Is this still the way to use absolute url's? Because it doesn't work at our project.

Below our setup. CustomSmidgeDefaultUrlManager.GetUrl doesn't get hitted.

CSHTML

@RenderSection("scripts", required: false)

startup.cs

services.AddSmidge(Configuration.GetSection("smidge"));
services.AddSmidgeInMemory();

services.AddScoped<IUrlManager, CustomSmidgeDefaultUrlManager>();
bundles.CreateJs("scripts", "~/dist/main.js")
          .WithEnvironmentOptions(BundleEnvironmentOptions.Create()
            .ForDebug(builder => builder
              .EnableFileWatcher()
              .SetCacheBusterType<AppDomainLifetimeCacheBuster>()
              .CacheControlOptions(enableEtag: false, cacheControlMaxAge: 0))
            .ForProduction(builder => builder
              .EnableCompositeProcessing()
              .EnableFileWatcher()
              .SetCacheBusterType<AppDomainLifetimeCacheBuster>()
              .CacheControlOptions(enableEtag: true, cacheControlMaxAge: 2592000))
            .Build()
          );

appsettings.json

  "smidge": {
    "dataFolder": "Smidge",
    "version": "2"
  },

CustomSmidgeDefaultUrlManager.cs
(note: equal to the default of smidge, however GetUrl throws an exception for testing purposes)

namespace Application.Smidge
{
    public class CustomSmidgeDefaultUrlManager : IUrlManager
    {

        public string GetUrl(string bundleName, string fileExtension, bool debug, string cacheBusterValue)
        {
            throw new Exception("hit");
        }

        // ...Other default smidge methods
    }
}
@Shazwazza
Copy link
Owner

Are you using this within an Umbraco install? It might be that Umbraco is already replacing this (can't remember)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants