Update: Full Source code is available at BitBucket
And the name of this is RazorJS.
Let’s see a few examples:
The JS File
The Razor Code
The Rendered HTML
What about performance?
The JS files are being cached just like Razor files with a CacheDependency so if a file changes the Razor template is being updated instantly. Every file is compiled just like Razor Pages and is being compiled the first time is requested or when a change is detected.
So the time to render each file the second time (and every time after) is really really small.
- For now the Nuget package doesn’t have a dependency to RazorEngine because it needs a later version to perform better which isn’t yet available. Once RazorEngine 2.2 is released I will update the package.
That’s all for now! You can find it at the Nuget Feed!