Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heestand-xyz/WebsiteResultBuilder
Write HTML & CSS in Swift
https://github.com/heestand-xyz/WebsiteResultBuilder
Last synced: about 1 month ago
JSON representation
Write HTML & CSS in Swift
- Host: GitHub
- URL: https://github.com/heestand-xyz/WebsiteResultBuilder
- Owner: heestand-xyz
- Created: 2021-02-19T18:18:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-19T18:18:38.000Z (almost 4 years ago)
- Last Synced: 2024-08-10T14:18:39.802Z (5 months ago)
- Language: Swift
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Website Result Builder
```swift
#if os(macOS)
let desktopURL: URL = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent("Desktop")
#endiflet htmlURL: URL = desktopURL.appendingPathComponent("index.html")
let html: HTML =
HTML {
Head {
Title("Test")
Link(rel: "stylesheet", href: "style.css")
}
Body {
Div(class: "test") {
"test"
"1 2 3"
}
A(id: "site", href: "http://heestand.xyz/") {
"Heestand XYZ"
}
}
}
try! html.render().write(to: htmlURL, atomically: false, encoding: .utf8)let cssURL: URL = desktopURL.appendingPathComponent("style.css")
let css: CSS =
CSS {
Class(name: "test") {
Property.position(.absolute)
Property.backgroundColor(.black)
Property.color(.white)
}
ID(name: "site") {
Property.backgroundColor(.gray)
}
}
try! css.render().write(to: cssURL, atomically: false, encoding: .utf8)```