ssgo

A minimalistic, unconfigurable static site generator.

ssgo is built with Deno, and aims to be used within a Deno ecosystem.

license: MIT code style: prettier netlify: passing

Documentation

Read the documentation at https://ssgo.netlify.app/docs.

Quickstart

To install ssgo using Deno:

deno install --unstable --allow-read --allow-write --allow-net -q https://deno.land/x/ssgo/ssgo.ts

To create a ssgo project starter just run:

mkdir my-ssgo-project && cd my-ssgo-project
ssgo init

Here’s what a ssgo project looks like:

β”œβ”€β”€ creators/    <- here go the scripts creating your pages
β”œβ”€β”€ templates/   <- here go the templates of your pages
β”œβ”€β”€ components/  <- here go your custom components
└── static/      <- here go your static files

To launch a build: just run:

ssgo

Your site will be built inside of the dist/ directory.s

To start development mode with file watching, and a hot reloaded dev server:

ssgo dev

The dist/ directory will be served over http://localhost:5580.

Overview

ssgo basically relies on two types of files: templates, and creators.

Templates are the skeleton of your pages and are simply HTML files living inside the templates/ directory (and its subdirectories):

<!-- templates/my-template.html -->

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>{{ title }}</title>

    <link rel="stylesheet" href="index.css" />
  </head>
  <body>
    <h1>Hello, ssgo !</h1>
    <p>Just run <code>ssgo dev</code> to get started !</p>
  </body>
</html>

Creators are like page factories. Using a buildPage function given by ssgo, they use templates and datas to build pages. Creators live in the creators/ directory (and its subdirectories):

// creators/my-creator.ts

import { BuildPage } from "https://deno.land/x/ssgo/mod.ts"

export default function (buildPage: BuildPage) {
  buildPage(
    "my-template.html",
    { title: "Hello, ssgo !" },
    {
      filename: "index.html",
      dir: "",
    }
  )
}

ssgo also provides much more cool stuffs like components and static files management. You can learn more about all this things by reading the documentation.

Roadmap

  • Add a support for a config file (.ssgorc, ssgo.config.js)
  • Provide a way to build only some creators (--only-creators=index.ts,other.js)
  • Export buildPage and ssgoBag from mod.ts to allow access from outside of creators
  • Serialize the cache on FS to allow faster cold builds
  • Find a way to clear import / compiler cache programmatically
  • Provide a way to opt out of static ressources resolution on a per-file basis