ANN: msx & gulp-msx - JSX for Mithril

1,331 views
Skip to first unread message

Jonathan Buchanan

unread,
Mar 26, 2014, 7:45:14 AM3/26/14
to mith...@googlegroups.com
Hi,

I've forked React's JSX Transformer to output element function calls in the format Mithril expects:

The transformer itself:

    https://github.com/insin/msx

A Gulp plugin for transforming from .jsx to .js:

    https://github.com/insin/gulp-msx

I've been generating content based on nested function calls/nested arrays/JSON-ML for many years, and while you do get used to writing nested structures, managing commas is a bit of a pain.

JSX on the other hand, appears to be off-putting to *everyone* initially until they realise it's just sugar for function calls, but in my opinion it solves one of the main problems generating DOM content in code. We're all used to deeply nesting HTML tags, closing tags help to provide context and there's no fiddling about with commas when you want to break a line for an additional argument or a subsequent element.

Once you get used to writing JSX, it's hard to go back. Mithril looks interesting to me so I'll be playing with it at some point when I get time/a suitable project, hence the ports.

There are examples of JSX input and JS output in the msx test directory [1], one of which is the TODO example from the Mithril docs:

    https://github.com/insin/msx/blob/master/test/jsx/example.jsx

----
Jonny

[1] https://github.com/insin/msx/tree/master/test

Leo Horie

unread,
Mar 26, 2014, 2:17:59 PM3/26/14
to mith...@googlegroups.com
That's really cool :)

Do you mind if I put a link to this tool on the Mithril docs?

Steven Garcia

unread,
Apr 1, 2014, 1:03:19 AM4/1/14
to mith...@googlegroups.com
This is awesome Jonathan. Will def be using it

Thanks for sharing!
Reply all
Reply to author
Forward
0 new messages