Skip to content

mvc-works/stir-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stir template

A simple HTML template script. It's supposed to be used in CoffeeScript or CirruScript which use indentations as syntax.

Usage

yarn add --dev stir-template

Methods:

stir.render
stir.createElement
stir.createFactory

Predefined:

stir.doctype
stir.html
stir.head
stir.body
stir.title

stir.link
stir.meta
stir.script
stir.style

stir.div
stir.span
stir.a
stir.code
stir.input
stir.textarea

Example in CoffeeScript:

{html, head, body, div} = stir

link = stir.createFactory 'link'
script = stir.createFactory 'script'

module.exports = (data) ->
  stir.render stir.doctype,
    html null,
      head null,
        link()
        script()
      body null,
        div name: 'a', 'empty'
        div()

Difference from React

stir-template does not escape DOM properties(which React does). Object properties are directly rendered to DOM properties.

License

MIT