0.0.1-alpha • Published 7 years ago

blockml-component v0.0.1-alpha

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

blockml-component

A component-based system with a virtual DOM for blockml (a simple language that creates HTML). It is similar to React and Angular, but intended to be as simple as possible.

Example usage:

var blockml = require('blockml');
blockml.component = require('blockml-component');

blockml.component('Page', {
  render: function (props, children) {
    return blockml`
      div {
        ${children}
      }
    `;
  }
});

// a custom "App" component that we can use in our code
blockml.component('App', {
  render: function (props, children) {
    return blockml`
      Page {
        h1 {
          "Hello World"
        }
        ${children}
      }
    `;
  }
});

// this will hold the rendered html
var html = blockml.render(`
  html {
    head;
    body {
      App {
        h1 {
          "Hello"
        }
      }
    }
  }
`));