GithubHelp home page GithubHelp logo

spank's Introduction

spank

Static Site Generator (SSG)

Exports HTML pages from your SPA

Usage

//spank.config.js
module.exports = {
  sitemap: 'path/to/a-list-of-urls.json',
  entrypoint: 'dist/__index.html',
  script: 'dist/main.js',
  outputDir: 'dist'
}

open your terminal and type

npx spank
Note

spank can also be used without a config. Use npx spank --help for parameters.


Config options

prop default description
sitemap .js or .json file with a list of relative paths. Eg. ['/', '/about', '/contact']
entrypoint dist/__app.html path to the HTML template to render the SPA in. Often static/index.html
script dist/build/bundle.js Path to the app script. Often dist/build/bundle.js or dist/build/main.js
outputDir dist Folder to save HTML files to.
forceIndex false Write /about to about/index.html instead of about.html
inlineDynamicImports false Required if app uses dynamic imports
concurrently 3 Max simultaneous running jobs
eventName If specified, HTMLs aren't saved till the page has emitted the event.
host http://jsdom.ssr Simulated host
blacklist [] List of paths to be ignored
depth 2 How far to crawl any path in the sitemap
ssrOptions {} Options to be passed to tossr

How does it work?

For each path in the sitemap, Spank creates a corresponding SPA in a simulated browser. Spank will crawl pages in the sitemap as far as depth is set. The HTML for each page is then saved to the output folder.


routify

spank's People

Contributors

jakobrosenberg avatar knopki avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.