-
Notifications
You must be signed in to change notification settings - Fork 7
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
Tag helpers don't work #8
Comments
Tag helpers are currently not implemented in RazorBlade. To be honest I'm not sure I want to add them, as this library is meant to be lightweight. It's supposed to generate simple HTML output, not fully-fledged pages which communicate with a server. I don't really want to reimplement ASP.NET. 🙂 Also, I expect the IDE support for them to be poor (it wouldn't recognize the special tags, it would just treat them as regular markup). In some cases, you can get a similar result by composing your templates: If this is insufficient, could you tell me what you're trying to do, so I can see how tag helpers would help? |
I'm trying to generate URLs from routes (either using the built-in anchor tag helper or using a custom tag helper). Right now I have So I can certainly live without tag helpers, it just seemed like it might be convenient. If tag helpers aren't going to be supported, it would be nice to produce an error from the generator if the template contains an |
Ok, I see. I think I'll play with them in the future to see how it goes. I didn't notice that |
I ended up adding an error when trying to use tag helpers. I tried to add support for them in the tag-helpers branch, but realized it would go off the rails. I wanted to integrate the Microsoft.AspNetCore.Razor.Runtime package (which implements tag helpers without depending on a lot of ASP.NET stuff) with RazorBlade: the idea was that you'd get tag helper support if you reference that package. Unfortunately, Microsoft deprecated it after I started implementing the feature. 🙄 So that's a dead end - it seems the tag helpers implementation will be shipped in the SDK, and not available as a nicely self-contained external NuGet package that I could use. Also, integrating the Razor runtime package wouldn't be seamless, since it would import stuff that RazorBlade implements on its own, and you wouldn't necessarily know which feature should be used in a given context. Maybe someday I could revisit this, but it's best to keep things simple for now I guess. |
Thanks for trying to make it work anyway! |
Tag helpers appear to not work despite using
@addTagHelper
.There's a lot of tag helper discovery code in the Razor SDK source generator that doesn't seem to have an equivalent in RazorBlade's source generator.
The text was updated successfully, but these errors were encountered: