Compel
Inspired by the delights of REACT, but not it's syntax.
Inspired by the syntax of Riot, but not by it's source.
Dive in, the water's lovely
Create a component...
Hey there ! Nice to meet you
Compile and use it...
Using my new component
Output looks something like:
Using my new component Hey there Randomer! Nice to meet you Hey there Terry Wogan! Nice to meet you
Attributes
All binding is used with attributes.
bind
Bind a scope variable to the template:
<!-- outputs -->bar
each
Bind an element to an array or key/value pairs:
Logic less looping
is years old
<!-- outputs --> Luke is 10 years old Lucy is 12 years old
"In each" loops
<!-- outputs --> Luke Lucy
"key, value in each" loops
is years old
<!-- outputs --> Luke is 10 years old Lucy is 12 years old
compel-*
Compel bloody anything! Any attribute beginning with compel-
will bind the
expression and replace it's referencing attribute. E.g:
<!-- outputs -->
Installation
- Install the compiler with node:
npm i compel
. - ...