riki
(work in progress)
npm install riki --save
Would you like to write your blogposts/README/articles like this?
:js: ; ; let box = width: 40 height:40 backgroundColor: 'red' :md: *Welcome* to the react-motionhttps://github.com/chenglou/react-motion/) playground! :render: <State initial=top:0 left:0> <Spring endValue=state> <div style=flex:1 onMouseMove= > <div style=...value ...box>move it move it</div> </div> </Spring> </State>
And then render it to html/native?
With riki, anything is possible.
; // returns {raw: String, content: function -> Array}
example
let src = `:js: let user = {id: 'threepointone', name: 'Sunil Pai'};:render: <div> Hello {user.name}! </div>`; let content = content; // gives [<div> Hello Sunil Pai!</div>], an array of react elements React;// "<div> Hello Sunil Pai!</div>"
options
locals
: map of locally available references when evaluating. These include stuff likeReact
,require
(needed if you're usingimport
), etctransforms
: map of transforms for different 'types'.js
, andrender
are included by default, so this is where you can pass transforms for markdown, jade, etcregex
: regular expression to detect:(type):
separators (defaults to/\n:([a-zA-Z0-9]*):\n/img
)transpile
: function to transform generated javascript before evaluating. use this to pass through babel, etc.
tests
npm test