/mimicui

Small tool to convert HTML into JS code.

Primary LanguageRustMIT LicenseMIT

mimicui

Build status Code Coverage License

Toy HTML-to-JS converter with both CLI and WASM frontends.

Try it here!

Example output

function createMimic() {
    const root = document.createElement('div');

    const paragraph = document.createElement('p');
    paragraph.style.cssText = 'sexy';

    const text = document.createTextNode('Hello, world!');

    root.appendChild(paragraph);

    paragraph.appendChild(text);

    return root;
}

Usage

  • Convert HTML code stored in the HTML file:

    mimicui <path>
  • Convert HTML read from STDIN:

    curl https://test.host/1.html | mimicui -

Development

Compiling from source

cargo build --target release

Compiling into WASM module

wasm-pack build --target web

Output will be put into the pkg/ directory.