Crates.io | wax-cli |
lib.rs | wax-cli |
version | 0.2.1 |
source | src |
created_at | 2022-11-04 18:01:51.102836 |
updated_at | 2022-11-10 14:59:21.768748 |
description | An extension of HTML written in Rust |
homepage | |
repository | https://github.com/mxcop/wax/ |
max_upload_size | |
id | 705348 |
size | 64,821 |
Install the Wax cli using cargo :
$ cargo install wax-cli
$ wax create <NAME>
$ wax build <PATH>
./<my-wax-site>/*
│
├─ .wax - # Wax file cache
├─ dist - # Wax build output
│
├─ src/* - # Your codebase (html, css, and js)
│ ├─ lib/ - # Html wax components
│ ├─ pages/ - # Your html pages
│ └─ ...
│
└─ wax.toml - # Wax config file
Wax components are an extension of html.
~ src/lib/my-component.html
<p>
Hello from my component ! :D
</p>
Importing / including wax components is done using the <wax!>
tag.
e.g. <wax! … src="[path]" … >
~ src/routes/index.html
<body>
…
<wax! src="../lib/my-component.html" />
…
</body>
Passing parameters to a component is done using html attributes.
e.g. <wax! … [key]="[value]" … >
~ src/routes/index.html
<body>
…
<wax! src="../lib/my-component.html" title="My dynamic title" />
…
</body>
Each component has to declare its parameters using <params! … [key] … >
Parameters can be inserted into the html using { [key] }
~ src/lib/my-component.html
<params! title>
<h1>
{ title }
</h1>
# wax.toml
[website]
pages = "RelativePath" # Path to the directory containing your index.html.
[build]
minify = "Boolean?" # If enabled, will minify the collapsed HTML files.
./assets
$ cargo run build ./assets