1.0.0 • Published 5 years ago

dainty v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

dainty

build status

render DOM to string server-side

A tiny library that simplifies rendering DOM to string server-side.

Installation

$ npm install dainty

Example

const dainty = require('dainty');

// Element shape is [name, attributes, children] 
const elements = [
  [
    'svg',
    {
      xmlns: "http://www.w3.org/2000/svg"
    },
    [
      'rect',
      {
        x: 10,
        y: 10,
        width: 30,
        height: 30,
        stroke: 'black'
      }
    ]
  ]
];

const string = dainty(elements);  // returns the elements as a string: '<svg ...>...</svg>'

API

dainty(elements) ⇒ string

Render DOM to string server-side

Kind: global function Returns: string - The elements as a string

ParamTypeDescription
elementsArrayAn array of elements to render

License

MIT

1.0.0

5 years ago

0.3.0

5 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago