5 ms·
Mithril "HTML" syntax is not for my taste: return m("html", [ m("body", [ m("input"), m("button", "Add"), m("table", [
by tipiirai 12y ago
Mithril "HTML" syntax is not for my taste:
return m("html", [
m("body", [
m("input"),
m("button", "Add"),
m("table", [
m("tr", [
m("td", [
m("input[type=checkbox]")
]),
m("td", "task description"),
])
])
])
]);
- dopamean 12y agoAgreed, it's not the best. Maybe you can help come up with something more palatable?
- insin 12y agoI did a quick tweak of React's JSX transpiler to output mithril-compatible code [1], as the above was the sort of syntax I was using JSX to get away from! return <html> <body> <input> <button>Add</button> <table> <tbody> <tr> <td><input type="checkbox"/></td> <td>task description</td> </tr> </tbody> </table> </body> </html> [1] https://github.com/insin/msx/ https://github.com/insin/msx/
- tipiirai 12y agoDefinitely more readable than Mithril
- istoica 12y agoyes man, this abstraction is horror, I hope mithril adheres to something else for declarative tasks a the one above
- rapind 12y agoI think it starts to look like HAML / Slim / Jade once you use CoffeeScript. Understandably not for everyone, but I quite like it, and it doesn't mess with your syntax highlighting like JSX does. m "body", m "input" m "button", "Add" m "table", m "tr", m "td", m "input[type=checkbox]" m "td", "task description"