0.0.26 • Published 5 years ago

carer v0.0.26

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Carer

Carer templating for Render frameworks such as HTML, React, React Native, Vue, etc

Setup:

Node:

const Decl = require('Carer')

Browser:

<script src='js/Carer.js' />
var Decl = Carer

Example use:

const template = {}
const appContext = {}

let decl = new Decl(template, appContext)
let output = decl.render()

Template Example:

{
  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.
    }
  }
}

Optional Context Example:

{
  user: { // element name
    // props
    username: 'Levi',
    loggedIn: true,
    admin: false,
  }
}

Output Example:

<div><h1>Welcome Levi</h1></div>

TODOs:

  • More error checking
  • Element ID's
  • Data binding for elements
  • Events for data binding
  • References to other elements

License:

MIT

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.15

5 years ago

0.0.14-pre

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.1

5 years ago