Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @ianmcburnie/marko-to-html with all npm packages installed. Try it out:

var markoToHtml = require("@ianmcburnie/marko-to-html")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@ianmcburnie/marko-to-html v0.0.2

Renders marko template output to file

marko-to-html

Renders marko template to html file.

template.marko

<h1>Hello ${data.name}!</h1>
<ul if="notEmpty(data.colors)">
    <li class="color" for="color in data.colors">
        ${color}
    </li>
</ul>
<div else>
    No colors!
</div>

data.json

{
    "name": "Frank",
    "colors": ["red", "green", "blue"]
}

From module

var markoToHtml = require('@ianmcburnie/marko-to-html');

markoToHtml('template.marko', 'data.json');

From command line

node index.js 'template.marko' 'data.json'

template.html

<h1>Hello Frank!</h1>
<ul>
    <li class="color">red</li>
    <li class="color">green</li>
    <li class="color">blue</li>
</ul>
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free