Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 896db73

Browse files
committed
conditionally use swift 5.3 features
1 parent d21a0fd commit 896db73

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Sources/swift-doc/Subcommands/Generate.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,24 @@ extension SwiftDoc {
133133
}
134134

135135
func fetchRemoteCSS() throws -> Data {
136+
#if swift(>=5.3)
136137
let cssURL = Bundle.module.url(forResource: "all.min", withExtension: "css")!
137138
return try Data(contentsOf: cssURL)
139+
#else
140+
let url = URL(string: "https://raw.githubusercontent.com/SwiftDocOrg/swift-doc/master/Resources/all.min.css")!
141+
return try Data(contentsOf: url)
142+
#endif
138143
}
139144

140145
func fetchRemoteJS() throws -> Data {
141-
let jsURL = Bundle.module.url(forResource: "all", withExtension: "js")!
146+
#if swift(>=5.3)
147+
let jsURL = Bundle.module.url(forResource: "all", withExtension: "js")!
142148
return try Data(contentsOf: jsURL)
149+
#else
150+
return Data("""
151+
window.addEventListener("load", ()=>{
152+
document.querySelector(".theme-select-container").hidden = true;
153+
})
154+
""".utf8)
155+
#endif
143156
}

0 commit comments

Comments
 (0)