CLI tool to generate HTML from a config file
Project description
📘 Stencil
stencil is a lightweight CLI tool that generates HTML files directly from a simple YAML or JSON configuration.
No need to manually write boilerplate HTML and CSS — just describe your UI in a config file, and stencil handles the rest.
✨ Features
- 📝 Define UI elements (
title,text,button) in YAML or JSON. - ⚡ Generates a ready-to-use
index.htmlwith clean CSS styling. - 🖱️ Automatic JavaScript stubs for button callbacks.
- 🔎 Auto-detects config file (
stencil.yamlorstencil.json) in your project root. - 🎯 Zero setup — just install and run.
📦 Installation
pip install stencil-ui
(requires Python 3.8+)
🚀 Usage
- Create a
stencil.yamlin your project root:
app:
- title: "My First Stencil Page"
- text: "Hello, world!"
- button:
label: "Click Me"
callback: "onClick"
- Run the CLI:
stencil
- That’s it! 🎉
index.htmlwill be generated in your project root.
🖼 Example Output
Given the above config, Stencil produces a styled HTML page like this:
⚙️ Configuration
Stencil looks for either:
stencil.yamlstencil.json
Supported elements:
| Element | Example | Output |
|---|---|---|
title |
- title: "My Page" |
<title> + <h1> |
text |
- text: "Hello World!" |
<p>Hello World!</p> |
button |
see example above | <button> with JS callback |
📂 Project Structure Example
my-project/
│
├── stencil.yaml
├── index.html # generated
└── css/
└── style.css
🛠 Development
Clone and install locally:
git clone https://github.com/your-username/stencil.git
cd stencil
pip install -e .
Run CLI from source:
python -m stencil
📜 License
This project is licensed under the MIT License.
💡 Inspiration
Stencil was built to simplify rapid prototyping of HTML pages from configs. Perfect for:
- Mockups & quick demos
- Teaching web basics
- Auto-generating documentation UIs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stencil_ui-0.1.2.tar.gz.
File metadata
- Download URL: stencil_ui-0.1.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d8095c7843abad99cee5fb8da3db595ea42e5c8192b906304dd4ac98e69beb8
|
|
| MD5 |
f788c16f04fd23b97164cb47546457fc
|
|
| BLAKE2b-256 |
fbc37870591b6d3055ff3a4b4e2949f1c888810489e0b16ac84ada18f69c56fb
|
File details
Details for the file stencil_ui-0.1.2-py3-none-any.whl.
File metadata
- Download URL: stencil_ui-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
680d1c25ab8bb7835562500a1440811ee02b0c7cb1ae7bf02b596f2b4df6aa94
|
|
| MD5 |
369fa3b5e29c9856cb594fa696ff22cc
|
|
| BLAKE2b-256 |
4f14d342b1a9cc1d676d3eba6396ecece7a49670231ae9753920f51d3995a6ad
|