Enable ki in the browser
lantiga opened this issue · comments
This is useful e.g. for a live ki demo on ki-lang.org
See here:
http://sweetjs.org/doc/main/sweet.html
https://github.com/mozilla/sweet.js/blob/3062bde9d3464adee868c98a2ced44d2316a6763/browser/editor.html
https://github.com/mozilla/sweet.js/blob/3062bde9d3464adee868c98a2ced44d2316a6763/browser/scripts/editor.js
Done, it works as of 896690a
Now look at the sweet.js editor and adapt it for ki.
- Also, remember to add grunt task to update ki.js and ki.sjs in the editor/scripts directory.
Will there be a distributable browser script available after this is closed? I'd like to embed ki into a blog post and show off some features without the build step.
You can take a look at the editor directory in master, which is the code for the live editor I just released. Basically you'll have to ship the whole editor/scripts directory and invoke the ki compiler as done in editor.js.
I'm not sure whether we can wrap everything up in one script, it depends on how things stand with sweet.js. I'll investigate.
(Looking forward to your blog post, BTW)
👍
Have you seen this?http://jlongster.com/Compiling-JSX-with-Sweet.js-using-Readtables
It seems like they were trying to resolve the same problem.
I've seen the post, in fact both ki and react.hiccup are operating in that space. In relation to mori, what the blog proposes is literals for constructing mori data structures rather than making it idiomatic to work with them.
I think ki could benefit from custom pattern classes and readtables, with reference to #10 and #7, both for handling syntax (instead of manually manipulating the AST) and for better error messages.