Rewrite to improve performance and the overall api

This commit is contained in:
Booklordofthedings 2024-12-06 14:56:47 +01:00
parent 1fbb94e9a2
commit 9f9cff55fa
12 changed files with 237 additions and 323 deletions

View file

@ -1,34 +1,20 @@
namespace Example_Website;
using System;
using Aven;
using Aven.HTML;
class Index : Page
class Index : Template
{
public override void LoadPageContents()
public this()
{
this.AddElement(
Div("Content aisjdoasjiodashuihnsduijhnuisdhfsd",
H1("Hello from Aven"),
Raw("Aven is a website generation library, that can be used from"), A("Beef")..SetValue("href", "https://Beeflang.org"), Raw("to generate reuseable html."), Br(),
Raw("By being integrated into a programming language you can freely write your own templating and generation logic"), Br()
)..SetValue("style", "padding: 15px;")
);
Title = "An aven website";
OutputFile = "\\Index.html";
}
public this() : base()
public override void Body(HTML body)
{
Title = scope $"Aven - {Aven.Version}";
this.AddInlineStyle("""
body {
margin:0px;
}
""");
body.Children.Add(Div(
H1("Aven Website"),
Div("adssadsadsadsadsad", "asidosadsadsd")..SetValue("Style", "color:red;")
));
}
}

View file

@ -9,8 +9,7 @@ class Program
public static void Main()
{
Aven aven = scope .();
aven.Pages.Add(scope Example_Website.Index());
aven.OutputDirectory = "../output/";
aven.Register(.Owning(new Example_Website.Index()));
aven.Build();
}
}