ClutchEngineering/slipstream
It's like SwiftUI for the web. Build static sites with Swift and Tailwind CSS.
Usage
Clone the Slipstream Site Template for a quick-start to deploying a Slipstream site to GitHub Pages.
Create an executable Swift package
mkdir mysite
cd mysite
swift package init --type executableAdd Slipstream to your package dependencies
Slipstream requires macOS 14.
platforms: [
.macOS("14"),
],
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 Foundation
import Slipstream
struct HelloWorld: View {
var body: some View {
Text("Hello, world!")
}
}
print(try renderHTML(HelloWorld()))Render a sitemap
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:
import Foundation
import Slipstream
struct HelloWorld: View {
var body: some View {
Text("Hello, world!")
}
}
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)Documentation
View Slipstream's complete documentation.
Community
To discuss Slipstream-related topics with other Slipstreamers, ask questions, or explore ideas, please use GitHub discussions.
Package Metadata
Repository: ClutchEngineering/slipstream
Homepage: https://slipstream.clutch.engineering/documentation/slipstream/
Stars: 75
Forks: 3
Open issues: 13
Default branch: main
Primary language: swift
License: MIT
Topics: static-site-generator, swiftui, tailwindcss
README: README.md