0.1.1 • Published 5 years ago

brap-ssg v0.1.1

Weekly downloads
2
License
GPL-3.0-or-later
Repository
github
Last release
5 years ago

Brap Static Site Generator

Jam out a static site

Design Goals

  1. Write markdown and YAML to HTML
  2. Use template functions (not templating languages)
  3. Support clean URLs

Install

npm install brap-ssg

Usage

brap --s 'src/md' --d 'build' --t 'your-template.js'

API

--s, --src Directory to read from (defaults to src/md)
--d, --dest Directory to write to (defaults to build)
--t, --template Template to apply
--c, --clean-urls Option to use clean URLs (defaults to true)

Example Markdown File

---
title: 'Whatever'
---
Lorem ipsum.

Example Template Function

// your-template.js
const yourTemplate = (html, { title } = metadata) => {
  return `<!DOCTYPE html>
<title>${title}</title>
<main>
  <h1>${title}</h1>
  ${html}
</main>
`
}

module.exports = yourTemplate

Weirdness with clean URLs (fix this pattern)

Bad

  • src/about-me/about-me.md => build/about-me/about-me/index.html
  • src/about-me/index.md => build/about-me/index/index.html

Good

  • src/about-me/about-me.md => build/about-me/index.html
  • src/about-me/index.md => build/about-me/index.html