Feather: Precompile the view templates of a custom widget assembly
Feather widget assemblies contain the view templates embedded into the assembly. The view templates are retrieved and compiled when a widget is rendered. Because of this, there is a delay of several seconds before a widget is rendered for the first time while the web application is running.
To avoid the initial rendering delay, you can precompile the templates so that they are ready for rendering when the widget is requested. This article describes how to precompile the templates in a widget assembly.
PREREQUISITES: You must have a Feather widget assembly and the views must be templates in C# Razor format (.cshtml
)
Perform the following:
- Install
RazorGenerator.MsBuild
package in the widget assembly project.
To do this, in the Package Manager Console, execute Install-Package RazorGenerator.MsBuild –Version 2.2.2
- Build the project.
RESULT: The built assembly contains the precompiled views that Feather will use.
NOTE: All view templates must remain embedded in the assembly.