Crates.io | html_gen |
lib.rs | html_gen |
version | 0.5.1 |
source | src |
created_at | 2020-09-05 17:33:30.299501 |
updated_at | 2020-09-24 11:50:21.83118 |
description | CLI tool to create static web pages using components |
homepage | |
repository | https://github.com/dcxo/html_gen |
max_upload_size | |
id | 285173 |
size | 82,850 |
Installation | Usage | Components and data
html_gen is a tool to generate static pages, using components and data written in json files
You will need cargo installed
> git clone https://github.com/dcxo/html_gen
> cd html_gen
> cargo install --path .
you can simply do:
> cargo install html_gen
> html_gen create [name] # If you don't write a name, html_gen will ask you
index.html
file, add some componets and some data (more on this later), and finally build the project with:> html_gen build
dist
folderTo create a component, you have to create a html file in the components
folder. The content of that file can be:
<Component [component's attributes]>
[component's body]
</Component>
like this to use attributes in your component, or directly without the Component
tag:
[component's body]
to not use attributes.
To use it, you just write in your index or other component
<[component's name] [component's attributes] />
To use data, create a json file in data
folder, for example, the file info.json
:
{
"name": "html_gen",
"tags": [
"components", "html"
]
}
to use it use wrap in double curly brackets {{...}}
a path to the value you want to use, i.e.:
<!-- html content -->
{{ info.name }}
{{ info.tags.0 }}
{{ info.tags.1 }}
<!-- more html content -->