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

Static files and Blazor start script section with CDN Url as parameter #34774

Closed
mariovh87 opened this issue Feb 20, 2025 · 3 comments
Closed
Assignees

Comments

@mariovh87
Copy link

mariovh87 commented Feb 20, 2025

[EDIT by guardrex to fix the code formatting. @mariovh87 ... FYI ... it's triple-backticks above and below for code blocks in issue comments.]

Description

In a WebApp project, I need the static files in App.razor, including the Blazor startup section:

<link href="main.css" rel="stylesheet"/>
<script src="_framework/blazor.web.js" autostart="false"></script>
<script>
  Blazor.start({
    webAssembly: {
      loadBootResource: function (type, name, defaultUri, integrity) {
        console.log(`Loading: '${type}', '${name}', '${defaultUri}', '${integrity}'`);
        switch (type) {
          case 'dotnetjs':
          case 'dotnetwasm':
          case 'timezonedata':
          case 'assembly':
             return `https://EP-custom-cdn.azurefd.net/_framework/${name}`;  
        }
      }
    }
  });
</script>

I want the CDN URL to be configurable via an environment variable in appsettings.json for production purposes.

How can this be done?

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/static-files?view=aspnetcore-9.0&source=docs#deliver-assets-with-map-static-assets-routing-endpoint-conventions

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/fundamentals/static-files.md

Document ID

25458428-030f-6acb-457e-1b4dfa722043

Article author

@guardrex

Metadata

  • ID: b0af7f84-f8dd-92d9-dacd-2aab76d3a039
  • PlatformId: 88af5647-85fa-eaf4-cbe1-4d0d4fdf521b
  • Service: aspnet-core
  • Sub-service: blazor

Related Issues

Copy link
Contributor

🌱🐇 Spring is coming. Hang in there! I'm pull'in for ya! 🐣🌻

Stand-by! ... A green dinosaur 🦖 will be along shortly to assist.

@guardrex
Copy link
Collaborator

Hello @mariovh87 ... I'll be OOF for a few hours and try to look at this by EOD. If I don't get back to you today, I'll try to get back to you on Friday morning. In the meantime if you can't wait, we recommend public support channels for help with Blazor. We recommend the usual popular places ...

@guardrex
Copy link
Collaborator

... and I'm BACK!

I don't think it's possible, but I'm not 100% sure. Can you open this question for the product unit on their repo at ...

https://github.com/dotnet/aspnetcore/issues

Please add ...

cc: @guardrex https://github.com/dotnet/AspNetCore.Docs/issues/34774

... to the bottom of your opening comment so that I can follow along. I might re-open this for doc work depending on what they say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants