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.
84 lines
3.6 KiB
84 lines
3.6 KiB
# Super Saiyan God
|
|
|
|

|
|
|
|
> __"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.
|
|
|
|
## Planned Features Needed
|
|
|
|
* Simply converts dir to other dir.
|
|
* Whatever templates I'm using, and markdown.
|
|
* Watches the dir and reruns the build when there's a change.
|
|
* Simple built-in webserver to view the changes.
|
|
* Possibly template lint or html lint.
|
|
* https://github.com/sourcegraph/go-template-lint
|
|
* https://www.djlint.com/docs/languages/golang/
|
|
* Code highlighting -- should that prism or something else?
|
|
|
|
## Usage
|
|
|
|
Create a default `ssgod.toml` config:
|
|
|
|
```shell
|
|
ssgod init
|
|
```
|
|
|
|
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:
|
|
|
|
```shell
|
|
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:
|
|
|
|
```shell
|
|
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.toml` file to enable `sync_dir` as an option:
|
|
|
|
```toml
|
|
views = "pages"
|
|
layout = "pages/layouts/main.html"
|
|
target = "public"
|
|
watch_delay = "500ms"
|
|
# comment this out to sync static
|
|
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.
|
|
|
|
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.
|
|
|