Swift DSL for rendering WebPages. Not the first, but the best (will become, one day... 😌)
// Swift
document {
html {
head {
title("My first Site")
}
body {
header {
h1("Hello, world!")
}
main {
h2("Rendered by Makeup.")
a("GitHub")
.href("https://github.com/maximkrouk/Makeup")
.foreground(color: .livingCoral)
}
footer {
h6("Makeup. Swift HTML-rendering framework.")
}
}
.font(name: .arial)
.foreground(color: .white)
.background(color: .ultraviolet)
}
}
is rendered to:
<!DOCTYPE HTML>
<html>
<head>
<title>
My first Site
</title>
</head>
<body style="font-family:'arial';color:rgba(255.0,255.0,255.0,255.0);background-color:rgba(100.0,83.0,148.0,255.0);">
<header>
<h1>
Hello, world!
</h1>
</header>
<main>
<h2>
Rendered by Makeup.
</h2>
<a href="https://github.com/maximkrouk/Makeup", style="color:rgba(250.0,114.0,104.0,255.0);">
GitHub
</a>
</main>
<footer>
<h6>
Makeup. Swift HTML-rendering framework.
</h6>
</footer>
</body>
</html>
and looks like:
Add the package to Your SwiftPM package dependencies:
.package(url: "https://github.com/MakeupStudio/Makeup.git", .branch("master"))
then add Makeup
dependency to your target.
.product(name: "Makeup", package: "Makeup")
----Not recommended for production use before the first release, but you are welcome to test it out 😉
You may contact me here if You want to contribute before the guide is provided or if You have any other questions or ideas.