Skip to content
A simple static-site generator for Enoki sites
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.npmrc
bin.js
index.js
package.json
readme.md

readme.md

enoki-build

Stability

A simple static-site generator for Enoki sites.

Installation

npm i enoki-build

Usage

enoki-build was designed to require minimal configuration and to be compatible with any Enoki environment.

Three things are required:

  1. an exported Choo application using the enoki module
  2. a nanocontent structured directory
  3. an index.html file that provides the base

1. The App

For the best experience, I'd recommend using @kodedninja/enoki, instead of the official package, as this contains optimalizations for pre-rendered sites.

3. index.html

enoki-build doesn't include bundles or does any magic, but only replaces the following:

  • <!-- @content --> ― with the HTML output of the app
  • <!-- @state --> ― with a <script> setting the window.initialState
  • <!-- @title --> ― with the title of the current page

For a simple static site, don't include the @head part and do not load the bundle script.

Example HTML:

<html>
  <head>
    <title><!-- @title --></title>
    <!-- @state -->
  </head>
  <body>
    <!-- @content -->
    <script src="/bundle.js"></script>
  </body>
</html>

You can check out my personal site as an example.

CLI

usage
  enoki-build [opts] [directories to copy]
options
  --app, -a <path>        the file where the choo app's exported (./index.js)
  --content, -c <path>    content directory (./content)
  --help, -h              show this help text
  --index, -i <path>      path of the index.html (./index.html)
  --output, -o <dir>      output directory (./public)
  --sitemap <url>         generate sitemap.xml with base url
  --version, -v           print version
examples
  start build
  $ enoki-build

  start build with different content folder and index
  $ enoki-build --content ../content --index ./random/index.html

  define directories to copy to the output
  $ enoki-build assets ../bundles
You can’t perform that action at this time.