| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Rune is a tool that combines different types of content (like YAML, HTML, Markdown, TSX, SVG, PNG, ZIP, JPG, and JSON) into one easy-to-use JSON format.
This output is designed to securely serve content through a REST API.
Rune is built for everyone on your team — developers, designers, and content creators. It simplifies collaboration by supporting familiar formats like HTML, YAML, Markdown, and TSX, making it easy to manage assets, translations, and views all in one place.
Think of Rune as a master basket weaver, skillfully crafting a basket to hold different kinds of fruits, each familiar to a specific audience:
Rune carefully weaves a basket — a JSON file — that organizes and holds all these fruits together in a portable and structured way. This basket isn't just static; it can be used as-is or handed to a backend, where more fruits (additional data or assets) can be added later to enrich its contents.
The result is an adaptable basket ready for any use case, whether it's for a simple picnic (a static web content) or a grand feast (a dynamic API-driven application).
To use Rune, ensure you have the following installed:
pip install -r requirements.txtYou can install Rune using pip:
pip install hyperify-runeOr clone the repository for development:
git clone https://github.com/hyperifyio/rune.git
cd runeAfter installing with pip, you can use the rune command directly:
rune <directory> <output_type>For example:
rune views jsonStructure your project directory as follows:
project/ # Contains YAML and HTML files ├── translations/ # Contains translation JSON files │ ├── HelloWorld.en.json │ └── HelloWorld.fi.json ├── assets/ # May contain images or other assets (or anywhere else on your system) └── Makefile # Makefile for build automation. Optional, for easier rebuild.
Example YAML file (views/HelloWorld.yml):
- type: "View"
name: "HelloWorld"
body:
- type: div
classes:
- "hello-world-container"
body:
- type: h1
body:
- "app.title"
- type: p
body:
- "app.content"Example HTML file (views/HelloWorld.html):
<View name="HelloWorld">
<div class="hello-world-container">
<h1>app.title</h1>
<p>app.content</p>
</div>
</View>Create translation files in translations/ (e.g., HelloWorld.en.json):
{
"app.title": "Hello, World!",
"app.content": "Welcome to Rune!"
}Run Rune to merge all YAML, HTML, and translation files into a single JSON:
python3 rune.py views jsonThe output will look like this:
[
{
"type": "View",
"name": "HelloWorld",
"body": [
{
"type": "div",
"classes": ["hello-world-container"],
"body": [
{"type": "h1", "body": ["app.title"]},
{"type": "p", "body": ["app.content"]}
]
}
]
},
{
"type": "i18n",
"data": {
"en": {
"app.title": "Hello, World!",
"app.content": "Welcome to Rune!"
}
}
}
]Define components with parameters and children:
Example (views/UsageCard.html):
<Component name="UsageCard">
<div class="card">
<UnfoldableCard title="usageCard.title">
<Component.Children></Component.Children>
</UnfoldableCard>
</div>
</Component>Embed files directly into the JSON output:
Example YAML asset (views/assets.yml):
- type: "Asset"
name: "logo"
body: "data:image/png;base64,xxxxx"Automatically embed images referenced in properties like Image, src, or custom attributes.
Example HTML (views/Example.html):
<Foo heroImage="../assets/logo.png"></Foo>CLI flags override configuration values when both are provided.
Examples:
rune --assets-dir out/assets views jsonrune --assets-prefix /static/assets views jsonpython3 rune.py <directory> <output_type>Rune is licensed under [./LICENSE.md](the Functional Source License, Version 1.1, MIT Future License).
For questions, feedback, or commercial inquiries, contact us at info@hyperify.io.
| Back | FazBrowse Home | New Git URL |