Add paths to configuration
This commit is contained in:
parent
cfb68f5237
commit
28623d1209
@ -5,4 +5,16 @@ struct Configuration {
|
||||
let pageImageWidth: Int
|
||||
|
||||
let minifyCSSandJS: Bool
|
||||
|
||||
let contentPath: String
|
||||
|
||||
let outputPath: String
|
||||
|
||||
var contentDirectory: URL {
|
||||
.init(fileURLWithPath: contentPath)
|
||||
}
|
||||
|
||||
var outputDirectory: URL {
|
||||
.init(fileURLWithPath: outputPath)
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,29 @@
|
||||
import Foundation
|
||||
|
||||
private let contentDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace")
|
||||
private let outputDirectory = URL(fileURLWithPath: "/Users/ch/Projects/MakerSpace/Site")
|
||||
|
||||
let configuration = Configuration(
|
||||
pageImageWidth: 748,
|
||||
minifyCSSandJS: true)
|
||||
pageImageWidth: <#T##Int#>,
|
||||
minifyCSSandJS: <#T##Bool#>,
|
||||
contentPath: <#T##String#>,
|
||||
outputPath: <#T##String#>)
|
||||
|
||||
let log = ValidationLog()
|
||||
let files = FileSystem(in: contentDirectory, to: outputDirectory)
|
||||
let files = FileSystem(
|
||||
in: configuration.contentDirectory,
|
||||
to: configuration.outputDirectory)
|
||||
|
||||
private let siteData: Element
|
||||
do {
|
||||
guard let element = try Element(atRoot: contentDirectory) else {
|
||||
guard let siteData = try Element(atRoot: configuration.contentDirectory) else {
|
||||
exit(0)
|
||||
}
|
||||
siteData = element
|
||||
|
||||
let siteGenerator = try SiteGenerator()
|
||||
try siteGenerator.generate(site: siteData)
|
||||
} catch {
|
||||
print(error)
|
||||
exit(0)
|
||||
}
|
||||
|
||||
private let siteGenerator = try SiteGenerator()
|
||||
try siteGenerator.generate(site: siteData)
|
||||
|
||||
files.printGeneratedPages()
|
||||
files.printEmptyPages()
|
||||
files.printDraftPages()
|
||||
|
Loading…
Reference in New Issue
Block a user