Create HTML from Beef
Find a file
2024-12-06 18:54:16 +01:00
Example_Website Final changes for version 1.0 2024-12-06 18:48:54 +01:00
src Final changes for version 1.0 2024-12-06 18:48:54 +01:00
.gitignore Initial 2024-10-30 14:03:57 +01:00
BeefManaged.toml changes 2024-11-28 12:24:54 +01:00
BeefProj.toml Initial 2024-10-30 14:03:57 +01:00
BeefSpace.toml Initial 2024-10-30 14:03:57 +01:00
BeefSpace_Lock.toml Copy to output for version 1.0 2024-12-06 18:14:15 +01:00
favicon.ico Initial 2024-10-30 14:03:57 +01:00
Rastergrafik.svg Initial 2024-10-30 14:03:57 +01:00
README.md Update README.md 2024-12-06 18:54:16 +01:00

Aven

Aven is an incredibly easy to use html page generator.
It achieves this by embedding html in Beef function calls, so that you can define your website layout in Beef while using all of the normal programming language features that Beef provides.
This results in naturally easy templating

class Program
{
	public static void Main()
	{
		Aven aven = scope .();
		aven.CopyToOutput("../favicon.ico", "favicon.ico");
		aven.Register(.Owning(new Index()));
		aven.Build();
	}
}

class Index : Template
{
	public this()
	{
		Title = "An Aven website";
		OutputFile = "Index.html";

		this.Styles = """
			body {
				background-color:#89c5bb;
				font-family: sans-serif;
				font-size: 1.2rem;
			}
			""";
	}

	public override void Head(System.String buffer)
	{
		buffer.Append("<link rel=\"icon\" href=\"favicon.ico\"/>");
	}

	public override void Body(HTML body)
	{

		body.Children.Add(Empty(
			H1("Aven"),
			Hr(),
			"Build static websites dynamically using Aven",
			Ul(
				Li("Fast"),
				Li("Easily extendable"),
				Li("Leverage the power of a normal programming language instead of just templating")
			),
			Br(),
			A("Aven Repository")..SetValue("href", "https://code.booklordofthe.dev/Booklordofthedings/Aven")
		));
	}
}