Carer templating for Render frameworks such as HTML, React, React Native, Vue, etc
const Decl = require('Carer')
<script src='js/Carer.js' />
var Decl = Carer
const template = {}
const appContext = {}
let decl = new Decl(template, appContext)
let output = decl.render()
{
div: {
someElement: {
condition: function() { return true }, // Accepts Function, Boolean, or String, returns Boolean or String
content: function() { return 'something' }, // Accepts Function, String, or Object, returns String or Object
tag: 'h2', // optional tag string, can be used instead of tags property.
tags: ['<h2>', '</h2>'], // optional tags, can be any valid HTML or framework syntax
props: { class: 'someElCls' }, // optional object which adds properties to tag.
}
}
}
{
user: { // element name
// props
username: 'Levi',
loggedIn: true,
admin: false,
}
}
<div><h1>Welcome Levi</h1></div>
- [ ] More error checking
- [ ] Element ID's
- [ ] Data binding for elements
- [ ] Events for data binding
- [ ] References to other elements