mithril-simpleapp /

Filename Size Date modified Message
23 B
changed modules from IIFEs to straight functions
1.7 KB created online with Bitbucket
3.5 KB
replaced old mithril term 'module' with new term 'component'
731 B
initial commit
46.7 KB
changed modules from IIFEs to straight functions


The new Mithril 1.x documentation is great! But I had some philosophical disagreements with the tutorial app.

Take a look at index.html to see my re-write.

At a high level, here are my issues with how the Mithril tutorial is presented:

Tooling required

The tutorial assumes you use a particular workflow and set of tools.

You cannot follow along unless you have Node installed (for NPM) and can call statements like

var m = require("mithril")

There is no such thing as require() in vanilla JavaScript.
Apparently there will be import and System.import() someday.

Some of us still write vanilla JavaScript for a browser with as few tools and libraries as possible.

And that's what attracted us to Mithril in the first place...

So my re-write is pure vanilla JavaScript requiring no other libraries or tools except Mithril.

Source split up

The tutorial app is a wonderful, tiny example program.

But the source is split up into tiny files and scattered into a heirarchy of directories.

Ugh! I hate this style.
I'm completely okay with other people doing this to their own codebase.

But what a terrible way to muddy the otherwise elegant simplicity of the application!

So my re-write is splat all in one file. Where you can see it all in one glance.

Espouses opinions about CSS, etc.

And I quote: "a good rule of thumb is to avoid the cascading aspect of CSS". What?

Look, I'm totally cool everybody's opinions about how to structure code and how to use CSS and such. But the tutorial is a weird place for it.

My re-write has a tiny little main.css file with some simple styles to make the app functional. That's it. You're not here to learn CSS. You're here to learn Mithril.