Flores
Minimalist static site generator.
Installation
$ npm install flores
Usage
const flores = require("flores");
(async () => {
await flores.build();
})();
Features
API
flores.build
Generate the website.
flores.build([options])
Parameters
flores.serve
Generate the website and serve it over the built-in Express server.
flores.serve([options])
Parameters
flores.watch
Generate the website and start the built-in Express server. It will also start the file watcher. On file changes, it will automatically regenerate the website and reload the browser.
flores.watch([options])
Parameters
Configuration Options
Configuration options is an optional Object
that you can pass to build
, serve
, or watch
function.
env
(String
): The environment name, default to process.env.NODE_ENV
. If the NODE_ENV
environment variable is not set, production
will be set. Note that for serve
and watch
methods, the env
value will always be set to development
. When it's set to production
, the generated HTML and CSS files will be minified.url
(String
): The website URL, default to http://localhost:4000
. Set the correct pathname if you don't serve the website on the root directory—like Github pages for repository (e.g. http://example.com/blog
). For serve
and watch
, the hostname will always be set localhost
and pathname will always be empty.basePath
(String
): The base path of your website project directory, default to the current working directory process.cwd()
.sourceDir
(String
): The directory for the website source relative to the basePath
, default to src
.outputDir
(String
): The directory where the generated website will be stored relative to the basePath
, default to public
,templatesDir
(String
): The templates directory relative to the sourceDir
, default to templates
.assetsDir
(String
): The CSS assets directory relative to the sourceDir
, default to assets
.defaultTemplate
(String
): The default template name for the markdown post, default to post.njk
. You can override the template for individual post by providing the template
field on the post's front matter.defaultCollectionTemplate
(String
): The default template name for the markdown post collection page, default to collection.njk
. You can override the template for individual post collection page by providing the template
field on the page's front matter.copyFiles
(Array
): List of files or file patterns to copy, default to:
["images/**", "robot.txt", "**/*.html"]`
{
permalink: true
}
{
containerHeaderHtml: "<h2>Table of Contents</h2>",
includeLevel: [2, 3, 4]
}
{
stage: 3,
preserve: false
}
Related
License
MIT © Risan Bagja Pradana