Skip to content

nijikokun/sugarcube-starter

Repository files navigation

SugarCube Starter

The easiest starter kit for building SugarCube stories with Twine / Tweego.

🎨 Features

  • Automatic Tweego & SugarCube Install ✅
  • Fully Configurable ✅
  • Automatic Builds ✅
  • Live Reload with Browser-Sync ✅
  • CSS Injection (no full reload) ✅
  • Directory for custom fonts ✅
  • Directory for third-party scripts ✅
  • Up to date packages and frameworks ✅

🗃 Tech Stack

Built in to this template are a number of frameworks to get you going.

ℹ Requirements

🚀 Getting Started

  1. Clone the repository
    npx degit nijikokun/sugarcube-starter <project-name>
    
  2. Install modules
    npm install
    
  3. Start developing
    npm start
    

New to SugarCube?

👩‍💻 Commands

Command Description
npm start Start development server with live reload
npm run dev Same as npm start
npm run build Production build to dist/
npm run tweego Run tweego manually
npm run tweego:install Install/reinstall tweego

📁 Directory Structure

.build/              # Build scripts
├── dev.ts           # Development server
└── tweego.ts        # Tweego installer & runner

src/                 # Source files
├── assets/
│   ├── app/         # Your JS/TS and SCSS
│   │   ├── index.ts
│   │   └── styles/
│   ├── fonts/       # Custom fonts
│   ├── media/       # Images and videos
│   └── vendor/      # Third-party scripts
├── story/           # Twine .twee files
└── head-content.html

dist/                # Compiled output (auto-generated)
.tweego/             # Tweego installation (auto-generated)

🙋‍♂️ How To

How do I disable Debug View?

Debug View is automatically enabled in development and disabled in production builds (npm run build).

To disable it in development, create src/story/PassageReady.twee:

:: PassageReady
<<run DebugView.disable()>>


How should I initialize variables?

Use the StoryInit passage in src/story/Start.twee:

:: StoryInit
<<set $health = 100>>
<<set $maxHealth = 100>>

:: Start

HP: <<= $health>> / <<= $maxHealth>>


How do I install macros?

Macros scripts and styles go into src/assets/vendor


How do I link to media files?

To reference images at src/assets/media/<asset_path>:

  • src/assets/media/favicon.pngmedia/favicon.png

Example in HTML:

<link rel="icon" type="image/png" href="media/favicon.png" />


How do I add Google Analytics?

Paste into src/head-content.html:

<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_TAG_HERE"></script>

Replace YOUR_TAG_HERE with your Google Analytics ID.

🤝 Helpful Resources

Official Resources

Third-Party Macros

💜 Acknowledgements

We are grateful to these individuals for their ideas and contributions.

📝 License

Licensed under the MIT License.

About

The modern starter kit for creating stories with Tweego, Twine and SugarCube.

Topics

Resources

Stars

Watchers

Forks

Contributors