Skip to content

Commit

Permalink
ADD smallest publishable static Blazor project
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivien FABING committed Oct 15, 2019
1 parent 0e6cdec commit 81d915a
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 1 deletion.
11 changes: 11 additions & 0 deletions App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@using Microsoft.AspNetCore.Components.Routing
@using SimpleStaticBlazor

<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" />
</Found>
<NotFound>
<p>Sorry, there's nothing at this address.</p>
</NotFound>
</Router>
8 changes: 8 additions & 0 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@inherits LayoutComponentBase
@page "/"

<div class="main">
<div class="content px-4">
<h1>Hello, world!</h1>
</div>
</div>
16 changes: 16 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Blazor.Hosting;

namespace SimpleStaticBlazor
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
}
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# SimpleStaticBlazor
# SimpleStaticBlazor
## Publish

`dotnet publish -c release`
15 changes: 15 additions & 0 deletions SimpleStaticBlazor.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19465.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace SimpleStaticBlazor
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}

public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
14 changes: 14 additions & 0 deletions wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>simple-blazor</title>
<base href="/" />
</head>
<body>
<app>Loading...</app>

<script src="_framework/blazor.webassembly.js"></script>
</body>
</html>

0 comments on commit 81d915a

Please sign in to comment.