All Projects → evansalter → webpack-static-site-generator

evansalter / webpack-static-site-generator

Licence: Unlicense License
A static site generator for Webpack

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to webpack-static-site-generator

Ng Static Site Generator
ng-static-site-generator is a webpack-based command line build tool that builds an Angular app and Jekyll-style blog entry html files into a static html and css website. It also supports building a client app so you can have static pages that are also capable of running dynamic functionality coded in Angular.
Stars: ✭ 42 (+200%)
Mutual labels:  prerender, static-site
stacy
Website generator that combines content from Contentful CMS with Handlebars templates and publishes the website in Amazon S3.
Stars: ✭ 24 (+71.43%)
Mutual labels:  static-site
website
The source code of Benjamin Lupton's website
Stars: ✭ 22 (+57.14%)
Mutual labels:  static-site
www
🦁 Source files for my personal site
Stars: ✭ 64 (+357.14%)
Mutual labels:  static-site
emanote
Spiritual successor to neuron, based on Ema.
Stars: ✭ 301 (+2050%)
Mutual labels:  static-site
tinystatic
A tiny static website generator which is flexible and easy to use
Stars: ✭ 36 (+157.14%)
Mutual labels:  static-site
landing
This project builds the static and internationalized landing page of Upplication.
Stars: ✭ 26 (+85.71%)
Mutual labels:  static-site
forever-jekyll
A simple, elegant & full featured Jekyll theme.
Stars: ✭ 26 (+85.71%)
Mutual labels:  static-site
nextjs-blog-starter-kit
NextJS Blog + Contentful Typescript Starter kit with Static Export 🚀
Stars: ✭ 56 (+300%)
Mutual labels:  static-site
scalajs-all-in-one-template
The All-in-One Scala.js static web project template
Stars: ✭ 47 (+235.71%)
Mutual labels:  static-site
gatsby-starter-landing-page
🖱 A simple, minimal Gatsby starter for quick and easy landing pages
Stars: ✭ 132 (+842.86%)
Mutual labels:  static-site
chatr
Chat app using Azure Web PubSub, Static Web Apps and other Azure services
Stars: ✭ 51 (+264.29%)
Mutual labels:  static-site
jigsaw-blog-template
Starter template for a blog, using Jigsaw by Tighten
Stars: ✭ 75 (+435.71%)
Mutual labels:  static-site
dimension-jekyll-theme
A Jekyll version of the "Dimension" theme by HTML5 UP.
Stars: ✭ 29 (+107.14%)
Mutual labels:  static-site
TechFusionFM
Static site for tech podcast built using Hexo.io with deployment script, XML escaper and iTunes rank tracking Telegram bot.
Stars: ✭ 20 (+42.86%)
Mutual labels:  static-site
steren
My personal website
Stars: ✭ 36 (+157.14%)
Mutual labels:  static-site
wordpress
Free PWA & SPA for Wordpress & Woocommerce
Stars: ✭ 103 (+635.71%)
Mutual labels:  single-page-app
juniorjobs
✌️ Curated entry-level jobs in the UK tech industry
Stars: ✭ 19 (+35.71%)
Mutual labels:  static-site
cakephpvue-spa
A CakePHP + VueJS single page application skeleton/boilerplate.
Stars: ✭ 40 (+185.71%)
Mutual labels:  single-page-app
rootlesscontaine.rs
Website to track the progress of rootless containers.
Stars: ✭ 40 (+185.71%)
Mutual labels:  static-site

Webpack Static Site Generator

Build Status npm version

A Webpack plugin to generate a static site based on a set of routes. This was written to work with a project generated by the Vue.js CLI, since I wasn't having any luck with other static site generators.

Installation

npm i --save-dev webpack-static-site-generator

OR

yarn add webpack-static-site-generator -D

Usage

In webpack.conf.js:

var StaticSiteGenerator = require('webpack-static-site-generator')

// Add the plugin to the plugin array
plugins: [
    new StaticSiteGenerator(
        // path to the output dir
        path.join(__dirname, './dist'), 
        // array of routes to generate
        [ '/'. '/about', '/blog', '/blog/blog-post-1' ],
        // [OPTIONAL] element (in querySelector style) to wait for before rendering.
        // defaults to 'body'
        '.main-container'
    )
]

The output will look something like this:

.
├── index.html
├── about
│   └── index.html
└── blog
    ├── blog-post-1
    │   └── index.html
    └── index.html

How it works

After Webpack generates the assets for your site, this plugin does the following:

  1. Serves the specified output directory using express
  2. Loads each provided route using Nightmare
  3. Saves the HTML of each route to the filesystem

Using on Travis CI

Nightmare uses Electron to render the pages, and it may require extra configuration on linux machines, including Travis CI. Since Electron is not fully headless, we need to set up xvfb (X Virtual Frame Buffer) to give Electron a virtual display it can use for rendering. This plugin is already set up to us xvfb when needed, we just need to install it.

Add the following to your .travis.yml:

sudo: required
addons:
  apt:
    packages:
      - xvfb
      - libxss1

Extra configuration may also be required for other CI systems.

Issues?

This plugin has not been extensively tested. I use it in one Vue.js CLI project, and it works quite well. If you have any trouble with it, create an issue and I'll see what I can do.

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].