uid |
---|
UnoWasmBootstrap.Features.AdditionalFiles |
The msbuild property WasmShellIndexHtmlPath
can be used to specify the path of a project-specific index.html
file.
This file should contain the following markers, for the runtime to initialize properly:
$(ADDITIONAL_CSS)
$(ADDITIONAL_HEAD)
Use this file as an example:
- Templates/index.html for bootstrapper 8.x.
- Templates/index.html for bootstrapper 7.x.
- Templates/index.html for bootstrapper 3.x.
- Templates/index.html for bootstrapper 2.x.
Providing additional JS files is done through the inclusion of EmbeddedResource
msbuild item files, in a project folder named WasmScripts
.
Files are processed as embedded resources to allow for libraries to provide javascript files.
Additional CSS files are supported through the inclusion of EmbeddedResource
msbuild item files, in a project folder named WasmCSS
.
Additional Content files are supported through the inclusion of Content
files. The folder structure is preserved in the output dist
folder. There is 3 deployment modes for content files:
Package
: files usingUnoDeploy="Package"
mode will be deployed in thedist\package_<hash>
folder and the folder structure will be preserved. This is the default mode for most files (see exclusions below).Root
: files usingUnoDeploy="Root"
mode will be deployed directly in thedist\
folder and the folder structure will be preserved.None
: files using theUnoDeploy="None"
mode will be ignored and won't be deployed.
Exclusions:
-
Files in the
WasmScript
folder will be set asUnoDeploy="None"
by default (they are not treat as content) -
Files in the
wwwroot
folder will be set asUnoDeploy="Root"
by default -
You can manually set the deploy mode in the
.csproj
in the following way:<ItemGroup> <!-- Manually set a file to be deployed as "root" mode --> <Content Include="Path\To\My\File.txt" UnoDeploy="Root" /> <!-- Manually set a file to be deployed as "package" mode -- overriding the default "root" mode for wwwroot --> <Content Include="wwwroot\config.json" UnoDeploy="Package" /> <!-- Manually set a file to be deployed as "none" mode (not deployed) --> <Content Include="wwwroot\output.log" UnoDeploy="None" /> </ItemGroup>
-
A few files extensions are excluded (
UnoDeploy="None")
by default such as*.a
,*.o
..html
files are those namedweb.config
will default toUnoDeploy="Root"
.
The file wwwroot/package_XXX/uno-assets.txt
contains the package relative paths of the content files that were copied to the wwwroot
folder.
It can be used to identify which assets are packaged with the application at runtime and avoid costly probing operations.
The files are specified in two parts:
- The files located in the
_framework
folder, which are all the assemblies used to run the app. The path in theuno-assets.txt
file is relative to the base uri of the site. - The files contained in
package_XXX
folder, which are the Content files specified at build time. The path in theuno-assets.txt
file is relative to thepackage_XXX
folder of the site.
Important
This file only contain files deployed in UnoDeploy="Package"
mode.