Antaris / RazorEngine

Open source templating engine based on Microsoft's Razor parsing engine
http://antaris.github.io/RazorEngine
Other
2.14k stars 577 forks source link

Idea: Separate out RazorEngine version support into individual assemblies. #345

Open coxp opened 8 years ago

coxp commented 8 years ago

I think the current method of switching the references to Razor based on the build configuration is quite complicated. Unless I'm missing something, it really messes up intellisense in VS for one.

I'm thinking something like MassTransit's way of using extension methods off a configuration object to add support for alternative logging frameworks might be a better method.

http://docs.masstransit-project.com/en/v2-master/overview/logging.html

https://github.com/MassTransit/MassTransit/blob/develop/src/Loggers/MassTransit.Log4NetIntegration/Log4NetConfigurationExtensions.cs

It would also potentially enable us to add support for alternate view engines, eg:

ViewEngine = ViewEngineFactory.New(vec =>
{
    vec.UseRazor(); // Different version of razor based on referenced nuget package
    vec.UseXml(tc => tc.EndsWith("*.csxml"));
});

ViewEngine.Render(model);
matthid commented 7 years ago

I never came up with a better way to do it (and I tried some stuff to separate some stuff apart).