shama / base-element

:beginner: An element authoring library for creating standalone and performant elements.
81 stars 7 forks source link

.toString()? #5

Closed yoshuawuyts closed 9 years ago

yoshuawuyts commented 9 years ago

When rendering on the server it can be neat to implement a .toString() function (or equivalent) to render components to html. I'm not sure what the tradeoffs are; but I think it's feasible to implement for every component. Thanks!

See Also

yoshuawuyts commented 9 years ago

Guess this would be shorthand for https://github.com/shama/base-element/blob/master/examples/server-side.js#L24-L31. Thinking the interface would look something like:

const str = el.toString(['This is', 'the initial', 'content'])
shama commented 9 years ago

+1 That's a good idea. Because then we could perform a render first too in case element hasn't been created.