1.1.1 • Published 6 years ago
enoki-build v1.1.1
enoki-build
A simple static-site generator for Enoki sites.
Installation
npm i enoki-buildUsage
enoki-build was designed to require minimal configuration and to be compatible with any Enoki environment.
Three things are required:
- an exported Choo application using the
enokimodule - a
nanocontentstructured directory - an
index.htmlfile 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 thewindow.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