TopazView 1.1.0
Prefix Reserveddotnet add package TopazView --version 1.1.0
NuGet\Install-Package TopazView -Version 1.1.0
<PackageReference Include="TopazView" Version="1.1.0" />
paket add TopazView --version 1.1.0
#r "nuget: TopazView, 1.1.0"
// Install TopazView as a Cake Addin #addin nuget:?package=TopazView&version=1.1.0 // Install TopazView as a Cake Tool #tool nuget:?package=TopazView&version=1.1.0
TopazView
TopazView is a lightweight view engine that utilizes the Topaz JavaScript Engine. It serves as an alternative to the Razor View Engine, offering several key features and benefits.
Key Features:
- Faster startup: TopazView is designed to provide quicker startup times compared to other view engines.
- Faster dynamic rendering: With TopazView, dynamic rendering is optimized for improved performance.
- JavaScript syntax familiarity: TopazView employs JavaScript syntax, making it more accessible and familiar to web developers.
- Simple learning curve: The template syntax used in TopazView closely resembles Razor, ensuring a smooth learning curve for developers.
- Support for page models, layouts, sections, helper functions: TopazView provides comprehensive support for page models, layouts, sections, and helper functions, enabling developers to create dynamic and modular views.
- Complete .NET API support: TopazView leverages the power of Topaz JavaScript engine to provide comprehensive access to the entire .NET API, giving developers extensive flexibility in their web development.
How to use TopazView?
The following sample shows the most basic setup of the TopazView.
using Tenray.TopazView;
var path = "web/views";
var viewEngine = new ViewEngineFactory()
.SetContentProvider(new FileSystemContentProvider(path))
.CreateViewEngine();
var contentWatcher = new FileSystemContentWatcher();
contentWatcher.StartWatcher(path, viewEngine);
The following is a sample of view rendering.
using Tenray.TopazView;
var context = viewEngine.CreateViewRenderContext();
context.Model = new { Title = "My Awesome TopazView Template" }.ToJsObject();
var html = await ViewEngine
// provide an existing text file's relative path with any extension.
.GetOrCreateView("/home/index.view")
.GetCompiledView()
.RenderViewToString(context);
The following is a sample view template file (index.view).
@Layout="../layouts/layout.view"
<div>@model.Title</div>
@{
for(const i of [1,2,3]) {
page.raw(i + ' <br>')
}
}
@if(@model.Title) {
<div>model has a title.</div>
}
else {
<div>model has no title.</div>
}
TopazView Sample for WebView 2:
Experience the live editor of TopazView to witness TopazView in action. TopazView WebView 2 Sample
TODO list:
To further enhance TopazView, the following tasks are on the agenda:
- Write documentation: Thorough documentation is essential for enabling developers to understand and utilize TopazView effectively.
- Provide samples: Offering a collection of sample applications and code snippets will assist users in grasping the practical usage of TopazView.
- Create developer-friendly exception page: Building an exception page specifically tailored to developers will facilitate error debugging and enhance the overall development experience.
Feel free to contribute to the project by tackling any of these tasks or suggesting additional improvements. Your involvement is greatly appreciated!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.