2 releases (1 stable)

1.0.0 Aug 29, 2024
0.1.0 Jun 17, 2024

#198 in Template engine

41 downloads per month

MIT/Apache

34KB
713 lines

OreStaty

OreStaty - HTML-centered handlebars-based static site generator

Using it as a library

Look at main.rs to see how you can use OreStaty as a library in your Rust projects

CLI

Subcommands:

  • init
  • build (assumed by default)
  • theme-to-css [-o/--output output.css] Flags:
  • -p/--path - specify project path (current directory by default)
  • -o/--output - specify output directory (dist by defalt)

Directory structure

Only "src" directory is mandatory. All files in it are gonna be built (.html/.htm/.hbs - handlebars, .md/.markdown - markdown + handlebars, .css/.scss/.sass - SASS) All files in "static" directory are gonna be copied to output directory In "plugins" directory you can put:

  • Handlebars templates for rendering HTML and Markdown
  • rhai helper scripts for Handlebars (see percent.rhai and page.md; Note: Handlebars helpers have scope in form of example_percent, not example.percent. Also, in Markdown you might need to escape quotes in string params)

All files in plugins directory get scope. For example, plugins/theme/template.html will be registered as Handlebars template with name theme.template "plugins" is a load path for SASS (if you put bulma-css into this directory, you can import it with @import bulma/bulma).

All files/directories showcased in this example of a directory tree:

project_directory
├─src
│  ├─index.html
│  ├─page.md
│  └─global.scss
│
├─static
│  ├─image.png
│  └─robots.txt
│
├─plugins
│  ├─example.rhai
│  └─bulma
│      ├─css
│      ├─sass
│      ├─versions
│      ├─bulma.scss
│      ├─LICENSE
│      ├─package.json
│      └─README.md
│
└─dist (auto generated)

Config

You can configure your site in config.toml Here is an example showcasing all possible config options:

default_template = "template"
default_markdown_template = "template"
code_highlight_theme = "InspiredGitHub"

TODO

Some stuff to do:

  • Dev server with file watching
  • Cache stuff
  • Parallelization

Dependencies

~14–23MB
~325K SLoC