JSFiddle - React, Tailwind, and code Playground

by fstarred

HTML

<main></main>

<script id='template' type='text/ractive'>
    <input type='range' value='{{foo}}' min='1' max='100' step='1'>
    <div decorator='mockDecorator:{{foo}}'></div>
</script>

CSS

body {
    font-family: 'Helvetica Neue', arial, sans-serif;
    font-weight: 200;
    color: #353535;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 200;
}

.error {
    color: #d00;
    font-family: monospace;
}

JavaScript

var ractive = new Ractive({
    el: 'main',
    template: '#template',
    data: {
        foo: 1
    },
    decorators: {
        mockDecorator: function ( node, foo ) {
            node.innerHTML = 'initial value of foo is ' + foo;
            
            return {
                update: function ( foo ) {
                    debugger;
                    node.innerHTML = 'updated value of foo is ' + foo;
                },
                teardown: function () {}
            };
        }
    }
});