1.2.2 • Published 4 years ago

tagl-mithril v1.2.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

tagl-mithril

Wrapper around tagl, a readability enhancement for hyperscript code. The example tagl function for mithril is extended by camelcase to hyphenated syntax for css-classes and ids.

Installation

npm install --save tagl-mithril

Example usage

import tagl_hyperscript from 'tagl-mithril';
import m from 'mithril'

const {
    nav, 
    section, 
    footer,
    h1, 
    div
} = tagl_hyperscript(m);

m.mount(document.body,{
    view(vnode) {
        return [
            nav.navbar.isInfo(
                '...'
            ),
            section.content.$home(
                h1.title('Hello Tagl And Mithril')
            ),
            footer.fixedBottom(
                '...'
            )
        ]
    }
})

The above snippet will be rendered to the DOM like this:

<nav class="navbar is-info">...</nav>
<section id="home" class="content">
  <h1 class="title">Hello Tagl And Mithril</h1>
</section>
<footer class="fixed-bottom">...</footer>

What you should have noticed ...

... is that you need to define all tags that you want to use as a result of tagl_hyperscript(m).

... is that isInfo was turned into is-info, because css classes don't like camelcase.

... is that $home was transformed into an id attribute for the section.

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago