Skip to content

A template language based on b-html

License

Notifications You must be signed in to change notification settings

bouzuya/b-html-plus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

b-html-plus

A template language based on b-html.

Usage

import bHtml from 'b-html-plus';

let source = `<ul
  <li
    @b-repeat user in users
    @b-text user.name
`;
let template = bHtml.compile(source);

let context = {
  users: [
    { name: 'bouzuya' },
    { name: 'emanon001' }
  ]
};
let html = template(context);

html === '<ul><li>bouzuya</li><li>emanon001</li></ul>';

Syntax

  • b-attr <attrs> ... attributes (e.g. @b-attr width: w, height: h)
  • b-html <html> ... innerHTML (e.g. @b-html html)
  • b-if <condition> ... remove tree if condition is falsy (e.g. @b-if show)
  • b-repeat <item> in <list> ... repeat (e.g. @b-repeat user in users)
  • b-text <text> ... innerText (e.g. @b-html text)

License

MIT

Author

bouzuya <m@bouzuya.net> (http://bouzuya.net)

About

A template language based on b-html

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CoffeeScript 100.0%