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

Bundle efforts? #102

Open
amoerie opened this issue Jan 12, 2019 · 3 comments
Open

Bundle efforts? #102

amoerie opened this issue Jan 12, 2019 · 3 comments

Comments

@amoerie
Copy link

amoerie commented Jan 12, 2019

Looks like we had the same idea!
https://github.com/amoerie/HtmlBuilders

Perhaps we can bundle our efforts? You definitely have the better library name!

@amoerie
Copy link
Author

amoerie commented Jan 12, 2019

You could probably steal half of my unit tests without even changing them, looking at your API!

@jbogard
Copy link
Contributor

jbogard commented Jan 18, 2019

Lol well that doesn't happen often. Do you see any major differences or things that this library is missing?

@amoerie
Copy link
Author

amoerie commented Jan 18, 2019

Did a quick compare, these are some things I noticed:

  • Your HtmlTag is not immutable. Mine started out as a mutable, but after running into some subtle bugs that could have been avoided with immutability, I converted everything a few years ago and haven't looked back.

  • Take a look at my "HtmlTags" class (note the trailing 's'). It contains shorthands for every HTML element out there. It reduced my use of magic strings (and thus opportunity for typo's) drastically. You seem to have created subclasses for some of the most common ones, but I couldn't a full equivalent in your codebase.

  • No support for parsing HTML strings / IHtmlContent? I often want to reuse things from an editor template, builtin HTML helper, ... and tweak a few things. So I included HtmlAgilityPack, and that now lets me write code like this:

  Html.LabelFor(m => m.SomeProperty).ToHtmlTag().Class("funky")

If the input implements IHtmlContent, you don't always have to parse HTML, as can be seen here:
https://github.com/amoerie/HtmlBuilders/blob/master/HtmlBuilders/HtmlTag.cs#L663

I probably missed a lot of things, but these stood out the most. I like how you integrate nicely with .NET core, and how you built a whole conventions system to prevent repetitive tasks. Usually, I just create mini HTML helpers for these, or display/editor templates where it makes sense. To be honest, I'm still not sold on tag helpers..

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