A babel plugin to statically optimize mithril hyperscript function invocations.
// This hyperscript function invocation
m(".fooga");
// Gets optimized into
m.vnode("div",undefined,{className:"fooga"},undefined,undefined,undefined);
Please file an issue if you come across any cases that this doesn't handle, I'd love to improve the number of structures I can rewrite!
mopt
only works with [email protected]
.
For optimizing [email protected]
see mithril-objectify.
Install with npm
npm i mopt
// .babelrc
{
"plugins": [ "mopt" ]
}
$ babel --plugins mopt script.js
require("babel-core").transform("<code>", {
plugins: [ "mopt" ]
});