SSG is a Static Site Generator that is only a Static Site Generator. No resumes here! Just a piece of code that generates static files from templates for websites, and can do it live while you develop said templates.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Zed A. Shaw 0df151c7e4 Forgot the go fmt. 3 days ago
art Create a funny parody logo. 3 months ago
config Quick hack for a 'metafile' feature that is able to work on all of the file names processed. Usually for a sitemap or rss feed. NOT WORKING. 3 days ago
example Now a simplistic sitemap/metapage feature works. Only has the URL for the page but more can come later. 3 days ago
tests Initial setup of the project directory. 3 months ago
.gitignore Switched to a .ssgod.json file to match other tools and to remove dependencies. Started using go:embed for the init. 3 days ago
LICENSE Create a funny parody logo. 3 months ago
Makefile Moved to the new /go URL. 2 months ago
README.md Switched to a .ssgod.json file to match other tools and to remove dependencies. Started using go:embed for the init. 3 days ago
go.mod Switched to a .ssgod.json file to match other tools and to remove dependencies. Started using go:embed for the init. 3 days ago
go.sum Switched to a .ssgod.json file to match other tools and to remove dependencies. Started using go:embed for the init. 3 days ago
main.go Forgot the go fmt. 3 days ago

README.md

Super Saiyan God

A parody of beerus

"This isn't even my final form."

SSG is a Static Site Generator that is only a Static Site Generator. No resumes here! I'll never work at Amazon, Google, or Microsoft so SSG doesn't include every single thing they've ever made. Just a piece of code that generates static files from templates for websites, and can do it live while you develop said templates.

Current Features

WARNING: I changed the file format to .json to reduce dependencies and also made it a hidden .ssgod.json file to match other tools.

  • Simply converts dirs to other dir.
  • Default Go templates, and markdown.
  • Watches the dir and reruns the build when there's a change.
  • Can also watch a static/ directory and sync that too.

Possible Future Features

Installation

You can install it with the latest tool system:

go get -tool lcthw.dev/go/ssgod

After that you have the ability to run the tool inside your project:

go tool ssgod

Usage

These instructions assume you're running the tool using go tool. If not then, I mean, you're a smart person right? Create a default .ssgod.json config:

go tool ssgod init

You can change the config file name with the --config option:

go tool ssgod --config mysite.json init

This option is available for all commands, so if you want to init a different config file then do as shown above.

The config assumes you have a public/ as a target, and a pages/ as source full of templates to render. You can change this in the config. Once you're ready run:

go tool ssgod

It will render all pages/**/*.md and pages/**/*.html into the public/ directory using the pages/layout/main.html as the layout. You can then have it watch your pages/ templates for changes and do a sync:

go tool ssgod watch

This will watch the directory and whenever you change something it'll rebuild. It has a 500ms delay to prevent running the render too often.

Syncing a static/ Dir

WARNING: This deletes your target public/ directory. It's assumed that you want to keep a clean public that is only built from other sources. Anything precious in public/ should be moved into static/ so ssgod can faithfully recreate your public/.

If you want to have ssgod sync a static directory then you have to uncomment a line in the .ssgod.json file to enable sync_dir as an option:

{
  "views": "pages",
  "layout": "pages/layouts/main.html",
  "target": "public",
  "watch_delay": "500ms",
  "sync_dir": "static"
}

In this example I've removed the comment. Once you do that ssgod will then remove your public/ directory on each run, but recreate it from the static/ and pages/ directory. This ensures your public/ is "clean" and doesn't contain any random junk that might mess up your build.

NOTE: This is a valid reason to do this, but the technical reason is that Go's os.CopyFS will error out when the target file exists. Not sure what kind of Nanny-State bullshit is going on over at Google but the only viable solution is to just remove the directory that's the target, or make my own os.CopyFS...but with Blackjack...and...and Hookers.

After that when you work on the templates it'll sync them over and rebuild your public for you.