suo sews together your JSON data with handlebars templates to generate a static website.
node suo.js someotherdatafile.json
This is still very alpha.
- Q: isn't there already a million static website generators that do this same thing? A: First of all "aren't there", and yes, I just wanted to do something similar to jekyll-perf and I also wanted to play around with node
How it works:
Files & folders:
files: this folder includes all static and binary files of the site: images, css/scss, js, etc
f: any font binaries go here
i: any images go here
s: any stylesheets go here, css or scss, compass and its dependent binaries should be installed separately
node_modules: this folder is generated by node when the required modules are imported by npm
templates: this is where all the handlebars templates for content are
www: the destination folder where all files will be placed
.gitignore: standard git ignore file
data.json: this is the JSON source of all data for the site
LICENSE: MIT license file
package.json: node js package file
README.md: standard readme
suo.js: the code to be executed
email@example.com ├── firstname.lastname@example.org ├── email@example.com ├─┬ firstname.lastname@example.org │ ├─┬ email@example.com │ │ ├── firstname.lastname@example.org │ │ ├── email@example.com │ │ └── firstname.lastname@example.org │ ├── email@example.com │ └─┬ firstname.lastname@example.org │ └─┬ forEachAsync@2.2.1 │ └── email@example.com ├─┬ firstname.lastname@example.org │ ├─┬ email@example.com │ │ └── firstname.lastname@example.org │ └─┬ email@example.com │ └─┬ firstname.lastname@example.org │ └── email@example.com ├── firstname.lastname@example.org ├── email@example.com ├── firstname.lastname@example.org └─┬ email@example.com ├─┬ firstname.lastname@example.org │ └── email@example.com ├─┬ firstname.lastname@example.org │ └── email@example.com └── firstname.lastname@example.org
Order of operation:
- there are a few config settings at the top of suo.js, if the paths in the
filesdirectory have changed then they need to be updated
- if files exist in the destination folder (
www), they are archived
- if files exist in the destination folder, they are deleted
- if the destination folder doesn't exist it is created
- assets are copied from the source folder (
- css/scss and js files are versioned and renamed based on their date modified
- the json data is parsed
- helper functions for handlebars are registered:
moment: date/time helper that uses moment js 2.
startsWith: boolean string function 3.
equals: boolean string function 4.
coalesce: inspired by SQL COALESCE, returns first non-null value 5.
static: references the static files processed and returns the correct path/name 6.
gravatar: returns gravatar hash for a given string
- handlebars templates from json data are processed
- pages from json data are processed
- list pages are processed: post archive, categories, rss/atom, home, manifest, sitemap
- the sitemap.xml file is gzipped
- time elapsed is displayed
- so many callbacks
- not generic enough
- so many refactorings
- include optional image compression?
- enable a dev mode for debugging css & js
Example site using suo: http://dieseltravis.github.io/