nicojs / typed-html

TypeSafe HTML templates using TypeScript. No need to learn a template library.
333 stars 51 forks source link

Support for basic fragments #42

Open SamJBarney opened 1 year ago

SamJBarney commented 1 year ago

Basic support for fragments is pretty simple:

export function createFragment(attributes: Attributes & Children | undefined = {},
    contents: string[]) {
        console.log(contents)
    return contents.join('')
}

Example of usage

Forcing sorting using <Fragment key="some id"> would take some work and could be considered for a later release.

See React Fragments

arthurfiorette commented 1 year ago

Hey @SamJBarney, This library seems to be unmaintained, (no license https://github.com/nicojs/typed-html/issues/23, no fragment support...) I'm maintaining @kitajs/html with some extra features I wanted to add, like fragments, ~3x times faster, a pre-compiled mode, null/undefined handling, preact (h) build systems compatible and more... Have a look at it!.