Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 911 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 911 Bytes

Parcel Transformer for ink scripts

This transformer compiles ink scripts into their JSON form, which you can then load into inkjs.

Getting Started

Install it with your favorite package manager: yarn add -D parcel-transformer-ink or npm i -D parcel-transformer-ink.

Make sure you have inkjs installed as well, or the compilation won't work.

Then include the transformer in your .parcelrc. In this example, we assume that the script has a .ink extension:

{
  "extends": ["@parcel/config-default"],
  "transformers": {
    "*.ink": ["parcel-transformer-ink"]
  }
}

In your game, you can then load scripts like any other asset:

import * as inkjs from "inkjs";

// @ts-ignore
import myScript from "../scripts/my-script.ink";

const story = new inkjs.Story(myScript);
console.log(story.Continue());