Hi, all! I'm trying to set up a theme for John Sundell's 'Publish' static site generator. I'm following the advice of this blog post here, which is to say
- File > New > Swift Package
- Add publish as a dependency, e.g.
import PackageDescription
let package = Package(
name: "FooTheme",
products: [
.library(
name: "FooTheme",
targets: ["FooTheme"]),
],
dependencies: [
.package(url: "https://github.com/johnsundell/publish.git", from: "0.5.0"),
],
targets: [
.target(
name: "FooTheme",
dependencies: ["Publish"]),
.testTarget(
name: "FooThemeTests",
dependencies: ["Publish"]),
]
)
- Create
Resources/FooTheme/styles.css
- Copy
Sources/Publish/API/Theme+Foundation.swift
from the Publish package toSources/FooTheme/Theme+Foo.swift
, updating references to the new theme
...
public extension Theme {
static var foo: Self {
Theme(
htmlFactory: FooHTMLFactory(),
resourcePaths: ["Resources/FooTheme/styles.css"]
)
}
}
private struct FooHTMLFactory<Site: Website>: HTMLFactory {
...
}
However, when I build the project, I get a cascade of Use of undeclared type
errors, e.g. Use of undeclared type 'Theme'
and Use of undeclared type
HTMLFactory`, as if it's not actually importing the dependency.
I cleaned the build folder and deleted derived data, but no joy so far. I get the same result using Xcode 11.3 and 11.4 beta, and Swift 5.1.
For whatever it's worth, the project is here on GitHub.
Am I doing something obviously wrong? Thank you!