Issue #564
Code
Steps
Step 1: Create executable
swift package init --type executable
Step 2: Edit package
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "PumaSwiftWeb",
dependencies: [
.package(url: "https://github.com/johnsundell/publish.git", from: "0.1.0")
],
targets: [
.target(
name: "PumaSwiftWeb",
dependencies: [
"Publish"
]
)
]
)
Step 3: Double click Package.swift, Xcode opens that in a generated project Step 4: Declare website. Go to Sources/main.swift
import Publish
import Plot
import Ink
import Foundation
struct PumaSwiftWeb: Website {
enum SectionID: String, WebsiteSectionID {
case gettingStarted
case workflow
case tasks
case about
}
struct ItemMetadata: WebsiteItemMetadata {}
var url = URL(string: "https://pumaswift.github.io")!
var name = "Puma Swift"
var description = "Build utilities in pure Swift"
var language: Language { .english }
var imagePath: Path? { "https://avatars2.githubusercontent.com/u/54233247?s=200&v=4" }
}
try PumaSwiftWeb()
.publish(withTheme: .foundation)
Step 5: Create Content folder
Step 6: swift run
Step 7: Copy Output to root and push to GitHub