html-creator icon indicating copy to clipboard operation
html-creator copied to clipboard

Feature: shortcuts for Tags

Open dggbond opened this issue 4 years ago • 2 comments

it takes too much time to write elements. there should be some shortcuts like this:

Tags.Meta({ charset: 'UTF-8' })
Tags.Head()
Tags.Title()

if the type not exist on the Tags, it should not be rendered.

dggbond avatar Dec 17 '21 06:12 dggbond

Hi, I appreciate the idea. The issue is that you would lose the type safety of html elements if we were to move from the typescript interface HTMLElement to adding one method for each element tag. Moreover it would be necessary to create and sync each of the ~130 html tags with the methods.

Also, the time it takes to type Tags.Head() compared to addElement({ type: "head" }) is miniscule :)

Hargne avatar Dec 21 '21 10:12 Hargne