Skip to content

Commit 5dfa527

Browse files
docs(common): update getting started to use static assets instead of CDN
1 parent 9b4e57c commit 5dfa527

File tree

2 files changed

+52
-30
lines changed

2 files changed

+52
-30
lines changed

_contentTemplates/common/js-interop-file.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,62 @@
66
#end
77

88
#add-js-interop-file-to-getting-started-client
9-
add the `telerik-blazor.min.js` file to your main index file - `wwwroot/index.html`:
9+
add the `telerik-blazor.js` file to your main index file - `wwwroot/index.html`:
1010

11+
**HTML**
12+
1113
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
1214

15+
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets)
1316
#end
1417

1518
#add-js-interop-file-to-getting-started-server
16-
add the `telerik-blazor.min.js` file to your main index file - `~/Pages/_Host.cshtml`:
19+
add the `telerik-blazor.js` file to your main index file - `~/Pages/_Host.cshtml`:
1720

21+
**HTML**
22+
1823
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
24+
25+
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets)
1926
#end
2027

2128
#js-interop-file-snippet
29+
<head>
30+
. . .
31+
<script src="_content/telerik.ui.for.blazor/js/telerik-blazor.js" defer></script>
32+
</head>
33+
#end
34+
35+
#path-to-trial-interop
36+
If you are using a trial license, the path is `_content/telerik.ui.for.blazor.trial/js/telerik-blazor.js`
37+
#end
38+
39+
#enable-static-assets
40+
To enable the use of static assets in your project, make sure you have the following line to your **Server** project `Startup.cs` file:
41+
42+
**C#**
43+
44+
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets-snippet)
45+
46+
#end
47+
48+
#enable-static-assets-snippet
49+
namespace MyBlazorAppName
50+
{
51+
public class Startup
52+
{
53+
public void Configure(IComponentsApplicationBuilder app)
54+
{
55+
//more code may be present here
56+
57+
//make sure this is present to enable static files from a package
58+
app.UseStaticFiles();
59+
}
60+
}
61+
}
62+
#end
63+
64+
#js-interop-file-snippet-cdn
2265
**HTML**
2366

2467
<head>
@@ -32,5 +75,5 @@
3275

3376
#app-paths
3477
Add the following to your main index file. For a server-side Blazor app it is `~/Pages/Index.cshtml`, and for a client-side Blazor app, it is `wwwroot/index.html`.
35-
#
78+
#end
3679

getting-started/what-you-need.md

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,41 +59,20 @@ To have the Telerik Blazor components look and behave as expected in the browser
5959

6060
* Our JS Interop file. It provides features that cannot be implemented with native Blazor.
6161

62-
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
62+
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet-cdn)
6363

6464

6565
### Static Assets
6666

6767
You can add the JS Interop file as a static asset from our package, instead of using a CDN.
6868

69-
To enable the use of static assets in your project, make sure you have the following line to your **Server** project `Startup.cs` file:
70-
71-
````C#
72-
namespace MyBlazorAppName
73-
{
74-
public class Startup
75-
{
76-
public void Configure(IComponentsApplicationBuilder app)
77-
{
78-
//more code may be present here
79-
80-
//make sure this is present to enable static files from a package
81-
app.UseStaticFiles();
82-
}
83-
}
84-
}
85-
````
86-
87-
Here is the `script` tag for our static asset path:
69+
**HTML**
70+
71+
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
8872

89-
````SHTML
90-
<head>
91-
. . .
92-
<script src="_content/telerik.ui.for.blazor/js/telerik-blazor.js" defer></script>
93-
</head>
94-
````
73+
Note that
74+
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets)
9575

96-
>note If you are using a trial license, the path is `_content/telerik.ui.for.blazor.trial/js/telerik-blazor.js`.
9776

9877
## Project Configuration
9978

0 commit comments

Comments
 (0)