A set of simple and modular packages for build automation.
Creating a static page generator can be incredibly easy! Create the following configuration file in the root of your project, install the used dependencies and run the hoast
command to start a build.
export default {
options: {
directory: 'src',
},
collections: [{
source: ['@hoast/source-readfiles', {
directory: 'pages',
}],
processes: [
'@hoast/process-frontmatter',
'@hoast/process-markdown',
['@hoast/process-handlebars', {
templateDirectory: 'layouts',
templatePath: 'default.hbs',
}],
['@hoast/process-writefiles', {
directory: '../dst',
}],
],
}],
}
Configuration files can have many forms
JSON
,JavaScript
objects,Hoast
instances, or use the API directly and call the process function to start building.
There is one core package that controls what and when the modules are run as well as the data provided to them. What modules should run in what order can be controlled using a configuration file or directly through code.
This repository contains the core package as well as first party modules and everything directly surrounding the project. For example all the packages can be found in packages
directory, the website's source code can be found in the .docs
directory and the build of the website is in the docs
directory.
The following list are project that are build with this project.
- hoast.js.org (source) - The Hoast website itself.
- doars.js.org (source) - The Doars website. Doars is a front-end library for declaring functionality in your markup.
- rondekker.com and rondekker.nl - My personal website and blog.
The following list serve as tools you can use directly, or as an example on how to make a solution that fits your needs.
-
examples
- Examples on how Hoast and several modules can be used.
-
hoast
- The core package of hoast responsible for managing and running the other packages. See this package for more information on how to create a config file.
-
source-custom
- Allows you to provide your own custom source functions. Extends base-source where the overridable functions can be provided via the options. Helps you from having to create a package for simple one-off behaviour. -
source-airtable
- Read data from Airtable bases. -
source-javascript
- Read and execute script from the filesystem. -
source-readfiles
- Read files from the filesystem.
-
process-custom
- Allows you to provide your own custom process functions. Extends base-process where the overridable functions can be provided via the options. Helps you from having to create a package for simple one-off behaviour. -
process-frontmatter
- Extract frontmatter from a text value. -
process-handlebars
- Template using Handlebars. -
process-javascript
- Retrieve and execute JavaScript. -
process-log
- Log data to the terminal, useful for developing other process and source packages. -
process-markdown
- Convert markdown to HTML using Unified. -
process-parse
- Parse a text value using a function or package. -
process-pdf
- Converts HTML to PDF using puppeteer. -
process-postprocess
- Process CSS, HTML, and JS data using PostCSS, Unified's rehype, and Babel plugins and minify using CleanCSS, Unified's rehype, and Terser. -
process-writefiles
- Write data to the filesystem.
-
base-package
- Provides basic functionality like receiving the library's reference and setting up a logger. -
base-process
- Provides basic functionality for process package like an initialization function, sequentially running of certain code, and filtering out running the process based of the data. -
base-source
- Provides basic functionality for source package like an initialization function, sequentially running of certain code, and a finallize function called after the source is done iterating. -
utils
- A package of utility functions used by several other packages in this list.