Index.html content override
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.
Support for additional JS files
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.
Support for additional CSS files
Additional CSS files are supported through the inclusion of EmbeddedResource msbuild item files, in a project folder named WasmCSS.
Support for additional Content files
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
WasmScriptfolder will be set asUnoDeploy="None"by default (they are not treat as content)Files in the
wwwrootfolder will be set asUnoDeploy="Root"by defaultYou can manually set the deploy mode in the
.csprojin 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..htmlfiles are those namedweb.configwill default toUnoDeploy="Root".
Asset dictionary
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
_frameworkfolder, which are all the assemblies used to run the app. The path in theuno-assets.txtfile is relative to the base uri of the site. - The files contained in
package_XXXfolder, which are the Content files specified at build time. The path in theuno-assets.txtfile is relative to thepackage_XXXfolder of the site.
Important
This file only contain files deployed in UnoDeploy="Package" mode.