Skip to content
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
6 changes: 5 additions & 1 deletion web-application/app/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Peachpie.AspNetCore.Web;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -55,7 +56,10 @@ public void Configure(IApplicationBuilder app)

//
app.UseDefaultFiles();
app.UseStaticFiles();

// use static files embedded in the compiled assembly
var fileProvider = new ManifestEmbeddedFileProvider(typeof(ResourceDemo).Assembly);
app.UseStaticFiles(new StaticFileOptions() { FileProvider = fileProvider });
}
}
}
Binary file added web-application/website/img/peachpie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions web-application/website/resourcedemo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php

class ResourceDemo
{
public function show() {
echo "<img src='img/peachpie.png' />";
}
}

(new ResourceDemo)->show();

?>
</body>
</html>
3 changes: 3 additions & 0 deletions web-application/website/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background-color: #f4511e;
}
3 changes: 3 additions & 0 deletions web-application/website/website.msbuildproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.*" PrivateAssets="All" />
<Compile Include="**/*.php" />
<EmbeddedResource Include="**/*.png;**/*.css" />
</ItemGroup>
</Project>