https://github.com/timstr/baumkuchen
simple static HTML site generator with XHTML syntax and reusable components
https://github.com/timstr/baumkuchen
Last synced: over 1 year ago
JSON representation
simple static HTML site generator with XHTML syntax and reusable components
- Host: GitHub
- URL: https://github.com/timstr/baumkuchen
- Owner: timstr
- License: mit
- Created: 2024-03-11T05:21:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-13T03:42:27.000Z (almost 2 years ago)
- Last Synced: 2025-01-22T02:31:19.024Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# baumkuchen
A simple and minimalist static HTML site generator. Use it when all you really need is to copy and paste some HTML around.
## Basic Usage
1. Start with ordinary HTML pages, either written from scratch or taken from an existing HTML website.
2. Identify repeated structure and extract it into a separate html file, defining a new element
3. Use the new element in your HTML pages as a shorthand
4. Run baumkuchen to substitute and expand elements, producing a complete HTML site.
## Example
Suppose we have a page like this:
```html
```
There's already a ton of repetition in this basic example. Let's first carve out the `
` and its contents. To do that, let's create a file `elements/myicon.html` with the following:
```html
```
This defines a new element called `myicon` which takes a `src` attribute. This lets us simplify the above page into:
```html
```
We could keep going if we like. For example, given `elements/myicongrid.html`:
```html
```
and `elements/myiconrow.html`:
```html
```
The page now can be reduced to
```html
```
We run baumkuchen by passing it the path to the shorthand HTML pages, elements, and output directory, respectively.
```plaintext
> baumkuchen path/to/pages/ elements/ output/
```
Afterwards, `output/` here contains all files (not just html) copied from the input directory, with any HTML files expanded according to the provided element library.
A few other utilities exist currently such as `` elements:
```html
```
and maybe a couple others as I create them.
## Caveats
- This library is new and experimental
- This is all the documentation that exists so far
- Yes, this is an abuse of notation.
- Efforts have been made to keep the syntax friendly for HTML text editors, but yours may not like the non-standard tag names
- Baumkuchen is not aware of what tags mean in any way. It just substitutes and expands the ones with names matching elmement files.
## About the name
[Baumkuchen](https://en.wikipedia.org/wiki/Baumkuchen) is German (like me) for a type of layer cake. It literally means "tree cake". Here, "tree" is a nod to the DOM tree, and "cake" as in baking, as in we're baking a static website from a higher-level authoring format.