Skip to content

Commit

Permalink
Merge pull request #10 from dotnet/typescript/static/assets/ra/7
Browse files Browse the repository at this point in the history
Typescript/static/assets/ra/7
  • Loading branch information
meslubi2021 authored Dec 19, 2024
2 parents f5b95c4 + b3260e6 commit 2362ab1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
23 changes: 7 additions & 16 deletions aspnetcore/razor-pages/ui-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,17 @@ In the following example, the `lib.css` stylesheet in the `wwwroot` folder isn't

To include TypeScript files in an RCL:

1. Reference the [`Microsoft.TypeScript.MSBuild`](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild) NuGet package in the project.
* Reference the [`Microsoft.TypeScript.MSBuild`](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild) NuGet package in the project.

[!INCLUDE[](~/includes/package-reference.md)]

1. Place the TypeScript files (`.ts`) outside of the `wwwroot` folder. For example, place the files in a `Client` folder.
* Place the TypeScript files (`.ts`) outside of the `wwwroot` folder. For example, place the files in a `Client` folder.
* Add the following markup to the project file:
* Configure the TypeScript build output for the `wwwroot` folder with the `TypescriptOutDir` property.
* Include the TypeScript target as a dependency of the `PrepareForBuildDependsOn` target.
* Remove the output in the `wwwroot folder`.

1. Configure the TypeScript build output for the `wwwroot` folder. Set the `TypescriptOutDir` property inside of a `PropertyGroup` in the project file:

```xml
<TypescriptOutDir>wwwroot</TypescriptOutDir>
```

1. Include the TypeScript target as a dependency of the `PrepareForBuildDependsOn` target by adding the following target inside of a `PropertyGroup` in the project file:

```xml
<PrepareForBuildDependsOn>
CompileTypeScript;
GetTypeScriptOutputForPublishing;$(PrepareForBuildDependsOn)
</PrepareForBuildDependsOn>
```
[!code-xml[](~/razor-pages/ui-class/remove.xml?highlight=6-10,14)]

### Consume content from a referenced RCL

Expand Down
17 changes: 17 additions & 0 deletions aspnetcore/razor-pages/ui-class/remove.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
// Markup removed for brevity.
<TypescriptOutDir>wwwroot</TypescriptOutDir>
<PrepareForBuildDependsOn>
CompileTypeScriptWithTSConfig;
GetTypeScriptOutputForPublishing;$(PrepareForBuildDependsOn)
</PrepareForBuildDependsOn>
</PropertyGroup>

<ItemGroup>
<Content Remove="wwwroot\{path-to-typescript-outputs}" />
</ItemGroup>

</Project>

0 comments on commit 2362ab1

Please sign in to comment.