Skip to content

Commit 5597ce1

Browse files
docs(common): static asset requirements and issues
1 parent 1b7e12c commit 5597ce1

File tree

5 files changed

+42
-54
lines changed

5 files changed

+42
-54
lines changed

_contentTemplates/common/get-started.md

+20
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,23 @@ To setup a local NuGet package source, so you can install the Telerik components
146146

147147
1. On the loaded page choose from your purchased products or trial downloads **Progress® Telerik® UI for Blazor**, and click on it.
148148
#end
149+
150+
#client-app-startup-file-mod-code
151+
namespace MyBlazorAppName.Client
152+
{
153+
public class Startup
154+
{
155+
public void ConfigureServices(IServiceCollection services)
156+
{
157+
//more code may be present here
158+
services.AddTelerikBlazor();
159+
}
160+
161+
public void Configure(IComponentsApplicationBuilder app)
162+
{
163+
//more code may be present here
164+
app.UseStaticFiles();
165+
}
166+
}
167+
}
168+
#end

_contentTemplates/common/js-interop-file.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#add-blazor-js-file-to-component
2-
add the `telerik-blazor.js` file to your main index file. For a client-side Blazor app, it is `wwwroot/index.html`, and for a server-side Blazor app it is `~/Pages/Index.cshtml`. For example:
2+
Add the `telerik-blazor.js` file to your main index file. For a client-side Blazor app, it is `wwwroot/index.html`, and for a server-side Blazor app it is `~/Pages/Index.cshtml`.
33

44
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
55

@@ -9,6 +9,8 @@
99
add the `telerik-blazor.js` file to your main index file - `wwwroot/index.html`:
1010

1111
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
12+
13+
>note @[template](/_contentTemplates/common/js-interop-file.md#static-asset-issue-in-pure-client-project)
1214
#end
1315

1416
#add-js-interop-file-to-getting-started-server
@@ -27,3 +29,7 @@
2729

2830
#end
2931

32+
#static-asset-issue-in-pure-client-project
33+
This static asset works for server-side and ASP.NET Core hosted client-side project types. If you use a purely client-side model, you must reference the script from our CDN, because of [an issue in the framework](https://github.com/aspnet/AspNetCore/issues/10986): `https://kendo.cdn.telerik.com/blazor/1.2.0/telerik-blazor.min.js`. Make sure that the version in the URL matches the version of the Telerik Blazor package used in your project.
34+
#end
35+

getting-started/client-blazor.md

+2-14
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,11 @@ For client-side Blazor, we recommend the usage of `Blazor (ASP.NET Hosted)` proj
5555

5656
1. @[template](/_contentTemplates/common/js-interop-file.md#add-js-interop-file-to-getting-started-client)
5757

58-
1. Open the `~/Startup.cs` file in the client web application and register the Telerik Blazor service:
58+
1. Open the `~/Startup.cs` file in the client web application and amend it to support static assets and to register the Telerik Blazor service:
5959

6060
**C#**
6161

62-
namespace MyBlazorAppName.Client
63-
{
64-
public class Startup
65-
{
66-
public void ConfigureServices(IServiceCollection services)
67-
{
68-
//more code may be present here
69-
services.AddTelerikBlazor();
70-
}
71-
72-
//more code may be present here
73-
}
74-
}
62+
@[template](/_contentTemplates/common/get-started.md#client-app-startup-file-mod-code)
7563

7664
1. @[template](/_contentTemplates/common/issues-and-warnings.md#mono-linker-issue)
7765

getting-started/what-you-need.md

+13-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ position: 3
1111

1212
# What You Need to Use the Telerik Blazor Components
1313

14-
This article explains the packages you need to use the Telerik UI for Blazor components, and how to get them.
14+
This article explains the packages you need to use the Telerik UI for Blazor components, how to get them, and how to configure your project to include the Telerik Blazor components.
1515

1616
To use the Telerik UI for Blazor, you need:
1717

@@ -52,15 +52,13 @@ To have the Telerik Blazor components look and behave as expected in the browser
5252
<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-default@latest/dist/all.css" />
5353
</head>
5454

55-
* Our JS Interop file. It provides features that cannot be implemented with native Blazor. You need to
56-
57-
@[template](/_contentTemplates/common/js-interop-file.md#add-js-interop-file-to-getting-started-client)
55+
* Our JS Interop file. It provides features that cannot be implemented with native Blazor. @[template](/_contentTemplates/common/js-interop-file.md#add-blazor-js-file-to-component)
5856

59-
For a server-side Blazor scenario, add it to the `~/Pages/_Host.razor` file.
57+
>warning @[template](/_contentTemplates/common/js-interop-file.md#static-asset-issue-in-pure-client-project)
6058
6159
## Project Configuration
6260

63-
To have the framework recognize the Telerik Components, you must register them in the `Startup.cs` file of your Blazor project (if you are using [client-side Blazor](), this is the client web application's file):
61+
To have the framework recognize the Telerik Components, you must register them in the `Startup.cs` file of your Blazor project (if you are using client-side Blazor, this is the Client web application's file):
6462

6563
````Startup.cs
6664
namespace MyBlazorAppName
@@ -78,9 +76,18 @@ namespace MyBlazorAppName
7876
}
7977
````
8078

79+
### Client-side Project Considerations
80+
8181
If you are using a **client-side Blazor** project,
8282
@[template](/_contentTemplates/common/issues-and-warnings.md#mono-linker-issue)
8383

84+
To enable the use of static assets for the JS Interop file, you must be using an ASP.NET Core hosted project and add the following line to your Client project `Startup.cs` file:
85+
86+
**C#**
87+
88+
@[template](/_contentTemplates/common/get-started.md#client-app-startup-file-mod-code)
89+
90+
8491
## Before You Continue
8592

8693
Before you continue, make sure you can use Blazor. Read below for more details.

knowledge-base/no-cdn-for-js-interop-file-1-2-0-and-later.md

-33
This file was deleted.

0 commit comments

Comments
 (0)