Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it like RazorEngine? #1

Closed
bnuzhouwei opened this issue May 9, 2020 · 2 comments
Closed

How to use it like RazorEngine? #1

bnuzhouwei opened this issue May 9, 2020 · 2 comments

Comments

@bnuzhouwei
Copy link

using RazorEngine;
using RazorEngine.Templating;
namespace RazorDemo.ConsoleDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            var template = "Hello @Model.Name, welcome to use RazorEngine!";
            var result = Engine.Razor.RunCompile(template, "templateKey1", null, new { Name = "World" });
            Console.WriteLine(result);
            Console.Read();
        }
    }
}
@elfalem
Copy link
Owner

elfalem commented May 10, 2020

I've just implemented this and released a new version (v0.2.0).

It can be used as follows:

var template = "<template>Hello {{Name}}, welcome to NVue!</template>";
var result = NVueTemplateEngine.RunCompile(template, "testtemplate", null, new { Name = "World" });
Console.WriteLine(result); // Hello World, welcome to NVue!

@bnuzhouwei
Copy link
Author

Nice work!

@elfalem elfalem closed this as completed May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants