All Projects → tj → Staticgen

tj / Staticgen

Licence: mit
Static website generator that lets you use HTTP servers and frameworks you already know

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Staticgen

Blended
The Most Versatile Static HTML Site Generator
Stars: ✭ 22 (-96.5%)
Mutual labels:  static-site-generator, static, static-site
React Static
⚛️ 🚀 A progressive static site generator for React.
Stars: ✭ 9,946 (+1483.76%)
Mutual labels:  static-site-generator, static-site, static
graphql-ssg
GraphQL data based Static Site Generator.
Stars: ✭ 30 (-95.22%)
Mutual labels:  static-site-generator, static
Verless
A simple and lightweight Static Site Generator.
Stars: ✭ 276 (-56.05%)
Mutual labels:  static-site-generator, static-site
Static Site Generators
A definitive list of tools for generating static websites.
Stars: ✭ 553 (-11.94%)
Mutual labels:  static-site-generator, static-site
eventually-jekyll-theme
A Jekyll version of the "Eventually" theme by HTML5 UP.
Stars: ✭ 26 (-95.86%)
Mutual labels:  static, static-site
11tyby
Simple 11ty setup using TypeScript, SASS, Preact with partial hydration, and other useful things. Aims to provide the DX of Gatsby, but using 11ty!
Stars: ✭ 38 (-93.95%)
Mutual labels:  static-site-generator, static-site
Skeleventy
A skeleton boilerplate built with Eleventy.
Stars: ✭ 318 (-49.36%)
Mutual labels:  static-site-generator, static-site
jigsaw-blog-template
Starter template for a blog, using Jigsaw by Tighten
Stars: ✭ 75 (-88.06%)
Mutual labels:  static-site-generator, static-site
Django Bakery
A set of helpers for baking your Django site out as flat files
Stars: ✭ 360 (-42.68%)
Mutual labels:  static-site-generator, static-site
Gridsome Portfolio Starter
A simple portfolio theme for Gridsome powered by Tailwind CSS v1
Stars: ✭ 329 (-47.61%)
Mutual labels:  static-site-generator, static-site
Charge
⚡️ An opinionated, zero-config static site generator.
Stars: ✭ 368 (-41.4%)
Mutual labels:  static-site-generator, static-site
startbootstrap-stylish-portfolio-jekyll
Jekyll theme based on Stylish Portfolio Bootstrap theme
Stars: ✭ 20 (-96.82%)
Mutual labels:  static-site-generator, static
TechFusionFM
Static site for tech podcast built using Hexo.io with deployment script, XML escaper and iTunes rank tracking Telegram bot.
Stars: ✭ 20 (-96.82%)
Mutual labels:  static-site-generator, static-site
simply-static-deploy
WordPress plugin to deploy static sites easily to an AWS S3 bucket.
Stars: ✭ 48 (-92.36%)
Mutual labels:  static-site-generator, static-site
stacy
Website generator that combines content from Contentful CMS with Handlebars templates and publishes the website in Amazon S3.
Stars: ✭ 24 (-96.18%)
Mutual labels:  static-site-generator, static-site
Devblog
A lightweight, customizable personal blog template built with GatsbyJS and React
Stars: ✭ 312 (-50.32%)
Mutual labels:  static-site, static
Assemble
Community
Stars: ✭ 3,995 (+536.15%)
Mutual labels:  static-site-generator, static-site
astro
Build fast websites, faster. 🚀🧑‍🚀✨
Stars: ✭ 11,024 (+1655.41%)
Mutual labels:  static-site-generator, static
tinystatic
A tiny static website generator which is flexible and easy to use
Stars: ✭ 36 (-94.27%)
Mutual labels:  static-site-generator, static-site

Staticgen

A static website generator that lets you use HTTP servers and frameworks you already know. Just tell Staticgen how to start your server, then watch it crawl your site and generate a static version with all of the pages and assets required.

About

If you're unfamiliar, you can actually use the decades-old wget command to output a static website from a dynamic one, this project is purpose-built for the same idea, letting your team to use whatever HTTP servers and frameworks you're already familiar with, in any language.

I haven't done any scientific benchmarks or comparisons yet, but here are some results on my 2014 8-core MBP:

Installation

Via gobinaries.com:

$ curl -sf https://gobinaries.com/tj/staticgen/cmd/staticgen | sh

Configuration

Configuration is stored within a ./static.json file in your project's root directory. The following options are available:

  • command — The server command executed before crawling.
  • url — The target website to crawl. Defaults to "http://127.0.0.1:3000".
  • dir — The static website output directory. Defaults to "build".
  • pages — A list of paths added to crawl, typically including unlinked pages such as landing pages. Defaults to [].
  • concurrency — The number of concurrent pages to crawl. Defaults to 30.

Guide

First create the ./static.json configuration file, for example here's the config for Go server, the only required property is command:

{
  "command": "go run main.go",
  "concurrency": 50,
  "dir": "dist"
}

Below is an example of a Node.js server, note that NODE_ENV is assigned to production so that optimizations such as Express template caches are used to improve serving performance.

{
  "command": "NODE_ENV=production node server.js"
}

Run the staticgen command to start the pre-rendering process:

$ staticgen

Staticgen executes the command you provided, waits for the server to become available on the url configured. The pages and assets are copied to the dir configured and then your server is shut down.

By default the timeout for the generation process is 15 minutes, depending on your situation you may want to increase or decrease this with the -t, --timeout flag, here are some examples:

$ staticgen -t 30s
$ staticgen -t 15m
$ staticgen -t 1h

When launching the command, Staticgen sets the STATICGEN environment variable to 1, allowing you to alter behaviour if necessary.

To view the pre-rendered site run the following command to start a static file server and open the browser:

$ staticgen serve

See the examples directory for full examples.

Notes

Staticgen does not pre-render using a headless browser, this makes it faster, however it means that you cannot rely on client-side JavaScript manipulating the page.


GoDoc

Sponsors

This project is sponsored by CTO.ai, making it easy for development teams to create and share workflow automations without leaving the command line.

And my GitHub sponsors:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].