Build static web pages with Swift and Tailwind CSS.
Slipstream is a static site generator built for Swift developers.
Add Slipstream to your package dependencies:
dependencies: [
.package(url: "https://github.com/jverkoey/slipstream.git", branch: "main"),
],
targets: [
.executableTarget(name: "MySite", dependencies: [
.product(name: "Slipstream", package: "slipstream"),
]
],And off you go:
import Slipstream
struct HelloWorld: View {
var body: some View {
Text("Hello, world!")
}
}
print(try renderHTML(HelloWorld()))Slipstream intentionally avoids making strong opinions about how your documents should be structured and written to disk. To help get you started though you can use Slipstream's lightweight sitemap renderer to write a dictionary of Slipstream views to disk:
let sitemap: Sitemap = [
"index.html": HelloWorld()
]
// Assumes this file is located in a Sources/ sub-directory of a Swift package.
guard let projectURL = URL(filePath: #filePath)?
.deletingLastPathComponent()
.deletingLastPathComponent() else {
print("Unable to create URL for \(#filePath)")
exit(1)
}
let outputURL = projectURL.appending(path: "site")
try renderSitemap(sitemap, to: outputURL)View Slipstream's complete documentation.
To discuss Slipstream-related topics with other Slipstreamers, ask questions, or explore ideas, please use GitHub discussions.