User Tools

Site Tools


entwine

This is an old revision of the document!


Entwine

Entwine is a tool that makes building large stories with Twine 2 easier. It's a good fit if you would like to:

  • Combine multiple stories in Twine into one single story
  • Include many external resources with your story – i.e. images, video, or audio
  • Edit CSS or JavaScript files from an external editor, instead of using Twine's built-in one

Entwine is a command-line tool that integrates with Grunt, which is a tool that automates repetitive tasks. If you don't have experience with Grunt or the command line, this can feel intimidating. It will take some setup work to use Entwine, but this document will guide you through it, and once you're done, your project will be able to build itself automatically as you make changes to its sources. That is, you'll be able to edit an image or change a passage and your project will automatically rebuild without you having to even choose Publish to File in Twine. For large projects, this tradeoff can be worth it.

This document assumes you want to use Entwine with Grunt. It's also possible to use Entwine on the command line by itself, if you're experienced with writing shell scripts. If you'd like to do this, follow the directions for installing Node below, then run npm install -g twine-utils. After that completes, running entwine –help will acquaint you with the direct command-line interface, and the Grunt Entwine task's documentation also provides more information as to what the options do.

There is no Entwine plugin for Gulp or Brunch, other popular task runners for Node, and no current plans to create them.

One-Time Setup

As the title indicates, you only need to complete the steps in this section once on your computer.

  1. Download the LTS version of Node from the official web site and install it by opening the file you download. LTS stands for “long-term support” – it lags behind the most current version, but is better-tested.
  2. Open a terminal window.
    1. On Windows, make sure to do this by following this path of options from the Start menu: Start → All Programs → Node.js → Node.js command prompt. Doing so will make sure that Node is properly available to you.
    2. On OS X, open the Terminal application that's the Utilities folder of your Applications folder.
    3. On Linux, how you open a terminal window depends on what distribution you're using. On Ubuntu, look under Applications → Accessories → Terminal.
  3. Type npm install -g grunt and press the Enter key. This command asks npm – short for the Node Package Manager – to install Grunt for you. The -g part ensures that you'll be able to use Grunt anywhere on your computer; it's installed globally.

npm will print out text as it installs Grunt. When you see the prompt again after it completes, you're done.

Project Setup

You'll need to do the steps in this section each time you set up a new project.

This document suggests a simple folder structure for your project, but you can use a different one if you prefer. Entwine doesn't require you to follow a particular scheme.

  • src (short for source) will contain all our source files. That means Twine story files, images or other multimedia, and CSS and JavaScript files.
  • build will contain any intermediate files that need to be created during the build process.
  • dist (short for distribution) will contain the end result of the process, ready to be posted to a web site or otherwise made available to the world.

Given that, here's what to do:

  1. Create a new folder for your project. In these examples, we'll call it my-project.
  2. Open a terminal window and go to this new folder.
  3. Create a folder named src inside the project folder. We don't need to create build or dist, but it doesn't hurt – Grunt will create them for us as needed.
entwine.1462984587.txt.gz · Last modified: 2017/10/10 00:37 (external edit)