Origami comics

Inline paths

Origami is a dialect of JavaScript expressions with inline paths instead of import statements.

site.js
// Standard JS
import greet from "./greet.js";

export default {
  "greeting.html": greet("world"),
};
site.ori
// Origami dialect of JavaScript expressions
{
  greeting.html: greet.js("world")
}

The greet.js gets the file’s default export.

You can call a JavaScript function by path in a site definition.

site.ori
// Origami dialect of JavaScript expressions
{
  greeting.html: greet.js("world")
}
http://localhost:5000/greeting.html
Hello, world!

Paths can also reference data in local or network files.

site.ori
{
  greeting.html: greet.js(teamData.json[0].name)
}
teamData.json
[
  {
    "name": "Alice",
    "location": "Honolulu"
  },
  {
    "name": "Bob",
    "location": "Los Angeles"
  }
]
http://localhost:5000/greeting.html
Hello, Alice!

Paths can let Origami be much more concise than the equivalent standard JavaScript!

site.ori
{
  "index.html": `<button>${ icons/home.svg }</button>`
}
site.js
import fs from "node:fs";
import path from "node:path";

export default {
  "index.html": `
    <button>
      ${fs.readFileSync(path.join(__dirname, "./icons/home.svg"))}
    </button>
  `,
};

Read more: Origami JavaScript expressions

Comic index