Closed MarkKharitonov closed 1 year ago
This Pull Request provides an answer to my question raised in the issue #491
I have changed the PR to actually implement the RazorLight.Precompile tool. What do you think?
I think it makes sense to abandon this PR and replace it with a new one. ?
I have just added an ability to render the given model by the precompile command.
Please, run precompile -h
and render -h
to get help.
Hi Mark. I hope you are well. I have an immediate family member in the hospital so this has been on hold for now. I promise it's not simply being ignored
@jzabroski - sorry to hear that. Hope things get better. Thanks for letting me know.
Getting to this now. Expect a reply in the next 3 days. I do think it looks good though
Thanks, Mark. Thank you as well for your patience while I worked through some things personally.
No problem. Thank you for merging. Does it going to publish to nuget.org automatically?
No, I have to do that but I will do it now assuming I can remember how I set it up on GitHub & the API key is not expired. :-)
@MarkKharitonov It looks like there is one failing test after I merged. Can you check? I am not immediately clear why it happened but I think its due to the backslash separator is not compatible with Ubuntu Linux?
Path separator are platform dependent :
For windows, it’s \ and for unix it’s /.
Failed RenderFolderRecursive("FullMessage.cshtml","folder\\MessageItem.cshtml",RazorLight.Caching.FileHashCachingStrategy) [93 ms]
Error Message:
RazorLight.RazorLightException : The razor template file /home/runner/work/RazorLight/RazorLight/tests/RazorLight.Precompile.Tests/bin/Debug/net6.0/Samples/folder\MessageItem.cshtml does not exist.
Stack Trace:
I will have a look
I think you just need a platform check. We use xunit, which has some platform specific features built-in via plugins. But if the test is only for .NET 6, you can also just use the .NET 6 platform abstraction APIs to detect the platform elegantly.
Actually you can probably just use https://learn.microsoft.com/en-us/dotnet/api/system.io.path.pathseparator?view=netframework-4.8 since it works across all versions
I need to setup a local linux environment to test, because it all passes on Windows.
I honestly dont think you need to go that far :-) You can fork GitHub repo and set-up actions locally in your repo using our template and just make the one line change i suggested to fix the issue. Have you ever just hit .
on a repo after forking it? You get a VS code editor in your browser.
I think there should be a PR workflow on this repository to prevent future inconveniences.
Anyway, I am able to run the workflow from my branch in my fork and I can see the problem. Will fix it.
This method allows to implement a persistent cache as opposed to the existing in-memory cache.
I do not include an implementation of such a cache. But an example of how this can be done is:
And then it can be used like this: