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

Typescript/static/assets/ra/7 #34175

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading