docs(common): update getting started to use static assets instead of CDN

This commit is contained in:
Marin Bratanov 2019-07-29 17:53:54 +03:00
Родитель 9b4e57c457
Коммит 5dfa527bdb
2 изменённых файлов: 52 добавлений и 30 удалений

Просмотреть файл

@ -6,19 +6,62 @@
#end
#add-js-interop-file-to-getting-started-client
add the `telerik-blazor.min.js` file to your main index file - `wwwroot/index.html`:
add the `telerik-blazor.js` file to your main index file - `wwwroot/index.html`:
**HTML**
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets)
#end
#add-js-interop-file-to-getting-started-server
add the `telerik-blazor.min.js` file to your main index file - `~/Pages/_Host.cshtml`:
add the `telerik-blazor.js` file to your main index file - `~/Pages/_Host.cshtml`:
**HTML**
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets)
#end
#js-interop-file-snippet
<head>
. . .
<script src="_content/telerik.ui.for.blazor/js/telerik-blazor.js" defer></script>
</head>
#end
#path-to-trial-interop
If you are using a trial license, the path is `_content/telerik.ui.for.blazor.trial/js/telerik-blazor.js`
#end
#enable-static-assets
To enable the use of static assets in your project, make sure you have the following line to your **Server** project `Startup.cs` file:
**C#**
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets-snippet)
#end
#enable-static-assets-snippet
namespace MyBlazorAppName
{
public class Startup
{
public void Configure(IComponentsApplicationBuilder app)
{
//more code may be present here
//make sure this is present to enable static files from a package
app.UseStaticFiles();
}
}
}
#end
#js-interop-file-snippet-cdn
**HTML**
<head>
@ -32,5 +75,5 @@
#app-paths
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`.
#
#end

Просмотреть файл

@ -59,41 +59,20 @@ To have the Telerik Blazor components look and behave as expected in the browser
* Our JS Interop file. It provides features that cannot be implemented with native Blazor.
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet-cdn)
### Static Assets
You can add the JS Interop file as a static asset from our package, instead of using a CDN.
To enable the use of static assets in your project, make sure you have the following line to your **Server** project `Startup.cs` file:
**HTML**
@[template](/_contentTemplates/common/js-interop-file.md#js-interop-file-snippet)
````C#
namespace MyBlazorAppName
{
public class Startup
{
public void Configure(IComponentsApplicationBuilder app)
{
//more code may be present here
//make sure this is present to enable static files from a package
app.UseStaticFiles();
}
}
}
````
Note that
@[template](/_contentTemplates/common/js-interop-file.md#enable-static-assets)
Here is the `script` tag for our static asset path:
````SHTML
<head>
. . .
<script src="_content/telerik.ui.for.blazor/js/telerik-blazor.js" defer></script>
</head>
````
>note If you are using a trial license, the path is `_content/telerik.ui.for.blazor.trial/js/telerik-blazor.js`.
## Project Configuration