This library is a simple DSL closer to JS than HTML, MD or MDX to create HTML elements. It enforces the use of config driven UI and is not meant to be used for complex components.
We use it to write our blog posts at https://dymme.com/blog. This tool helps us to ship faster and to focus on the content rather than the layout or tooling.
npm install layout-composer
import { init } from '@dymme/layout-composer';
// Add your own composers at init or use the default ones
const composer = init([
{
name: 'Button',
key: 'btn',
fn: (src: string) => `<button>${src}</button>`
}
]);
// Or create one at any time
composer.defineComposer('Button', 'btn', (src: string) => `<button>${src}</button>`);
// Use it
composer.render(['text', 'img:https://example.com/image.png', 'btn:click me!'])
1.0.2
MIT