Installing Origami

This page outlines the basics steps to install Origami for use on your machine.

Install Node.js #

Origami requires Node.js. You’ll need to download and install that first.

Install the Origami command-line interface #

Once you have Node installed, the simplest option is to install Origami globally:

$ npm install --global @weborigami/origami

Then verify that Origami is installed:

$ ori

Origami should display some basic help instructions.

If you don’t want to install Origami globally, you can still invoke Origami within the context of a project using npm run commands — see below.

Create a package.json file #

A typical Origami website project will exist in a folder containing a package.json file

Create a new folder and name it whatever you want.

Inside the folder create a file called package.json and paste in the following:

{
  "name": "my-origami-project",
  "type": "module",
  "dependencies": {
    "@weborigami/origami": "0.3.2"
  },
  "scripts": {
    "build": "ori copy src/site.ori, clear files:build",
    "start": "ori serve watch src, =debug src/site.ori"
  }
}

Update the name field to reflect the name of your project.

Create an Origami file #

Origami projects often put the Origami files in a src folder (but you can organize your source files however you want).

Inside your project’s top folder, create a folder called src.

Inside the src folder, create a file called site.ori and paste in the following:

{
  index.html = "Hello, world!"
}

This defines a tiny site with a simple home page.

You can work with this tiny site in the command line. If you installed Origami globally:

$ ori src/site.ori/index.html
Hello, world!

If you didn’t install Origami globally, prefix the command with npx:

$ npx ori src/site.ori/index.html
Hello, world!

Start the Origami server:

$ npm run start
Server running at http://localhost:5000

If you open the indicated URL in your browser, you should see “Hello, world!”