postal
postal copied to clipboard
Basic support for layouts outside MVC.
This is a very quick spike to get layouts working via the RazorEngine.
The layout name must be the path to the layout file, relative from the root path specified when constructing the FileSystemRazorViewEngine
. (e.g. asp.net style Layout = "~\Views\EmailLayout.cshtml"
is not supported).
I can put some more time into this, but before proceeding wanted to check if it's ok to upgrade the RazorEngine version used. It currently uses 3.4.1, and 3.5 introduced quite a few API changes, so I'd rather upgrade to that before writing too much code against the old API.
Hey thanks for picking this up. It's a frequently requested feature.
I've not looked at RazorEngine 3.5, but I assume we should be OK to upgrade.
Can this be merged please?
Must have
We really need this.
Sorry everyone, I haven't had any spare time to work on this. Probably won't for a while either. Someone else feel free to pick it up.
This PR does work as is though, with the limitations mentioned above. Or you can plug it into the current Nuget version of Postal. I'm doing it like this currently:
https://gist.github.com/tystol/9fd4db5e42d5d1943e60
Working well for me so far.
Thanks @tystol , I actually just upgraded your code to use the latest API from RazorEngine and so far it seems to do the trick.
For anyone else dealing with this issue here's the upgrade of the gist @tystol posted for the newest version of RazorEngine https://gist.github.com/mbcrawfo/2269f5a1a402792ff2d8
+1 for merging this