carer
cares about you
Last updated 9 months ago by lopu .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install carer 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.26                                ...           latest (9 months ago)

14 Versions

  • 0.0.26                                ...           9 months ago
  • 0.0.25                                ...           9 months ago
  • 0.0.24                                ...           9 months ago
  • 0.0.23                                ...           9 months ago
  • 0.0.22                                ...           9 months ago
  • 0.0.21                                ...           9 months ago
  • 0.0.20                                ...           9 months ago
  • 0.0.19                                ...           9 months ago
  • 0.0.18                                ...           9 months ago
  • 0.0.15                                ...           9 months ago
  • 0.0.14-pre                                ...           9 months ago
  • 0.0.12                                ...           9 months ago
  • 0.0.11                                ...           9 months ago
  • 0.0.1                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 14
Dependencies (2)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |