Skip to content

Commit 6564e7c

Browse files
committed
Add hello world sample for razorslices
1 parent 5b49598 commit 6564e7c

File tree

8 files changed

+73
-0
lines changed

8 files changed

+73
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Greetings from Cairo, Egypt. You can [sponsor](https://github.com/sponsors/dodyg
4646
| [Path String (HttpContext.Request.Path)](/projects/path-string) | 1 | |
4747
| [Problem Details Middleware](/projects/problem-details-middleware/) | 3 | |
4848
| [Razor Pages](/projects/razor-pages) | 10 | TempData |
49+
| [Razor Slices](/projects/razor-slices) | 1 | |
4950
| [Request](/projects/request) | 15 | Form, Cookies, Query String, Headers |
5051
| [Request Timeouts Middleware](/projets/request-timeouts-middleware) | 6 | |
5152
| [Response](/projects/response) | 3 | |

projects/razor-slices/README.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# RazorSlices
2+
3+
* [Hello World](hello-world)
4+
5+
This is the simplest sample on how to start using RazorSlices, a Razor-based template engine that does not require MVC, Razor Pages, nor Blazor.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#0c5dc8",
4+
"activityBar.background": "#0c5dc8",
5+
"activityBar.foreground": "#e7e7e7",
6+
"activityBar.inactiveForeground": "#e7e7e799",
7+
"activityBarBadge.background": "#f669a6",
8+
"activityBarBadge.foreground": "#15202b",
9+
"commandCenter.border": "#e7e7e799",
10+
"sash.hoverBorder": "#0c5dc8",
11+
"statusBar.background": "#094798",
12+
"statusBar.debuggingBackground": "#985a09",
13+
"statusBar.debuggingForeground": "#e7e7e7",
14+
"statusBar.foreground": "#e7e7e7",
15+
"statusBarItem.hoverBackground": "#0c5dc8",
16+
"statusBarItem.remoteBackground": "#094798",
17+
"statusBarItem.remoteForeground": "#e7e7e7",
18+
"titleBar.activeBackground": "#094798",
19+
"titleBar.activeForeground": "#e7e7e7",
20+
"titleBar.inactiveBackground": "#09479899",
21+
"titleBar.inactiveForeground": "#e7e7e799"
22+
},
23+
"peacock.color": "#094798"
24+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var app = WebApplication.Create();
2+
3+
app.MapGet("/", () => Results.Extensions.RazorSlice<HelloWorld.Slices.Index, string>("Hello world"));
4+
5+
app.Run();
6+
7+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Hello world
2+
3+
This is a hello world sample based on [RazorSlices](https://github.com/DamianEdwards/RazorSlices), Razor-based template engine. The Nuget Package is available [here](https://www.nuget.org/packages/RazorSlices).
4+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@inherits RazorSliceHttpResult<string>
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
</head>
7+
<body>
8+
<p>
9+
Greetings @Model at @DateTime.UtcNow
10+
</p>
11+
</body>
12+
</html>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@inherits RazorSliceHttpResult
2+
3+
@using System.Globalization;
4+
@using Microsoft.AspNetCore.Razor;
5+
@using Microsoft.AspNetCore.Http.HttpResults;
6+
7+
@tagHelperPrefix __disable_tagHelpers__:
8+
@removeTagHelper *, Microsoft.AspNetCore.Mvc.Razor
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<ImplicitUsings>true</ImplicitUsings>
5+
<RootNamespace>HelloWorld</RootNamespace>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
</ItemGroup>
9+
<ItemGroup>
10+
<PackageReference Include="RazorSlices" Version="0.8.1" />
11+
</ItemGroup>
12+
</Project>

0 commit comments

Comments
 (0)