Fix script imports
This commit is contained in:
@ -99,8 +99,11 @@ struct HTMLElementsGenerator {
|
||||
"""
|
||||
}
|
||||
|
||||
func scriptInclude(path: String) -> String {
|
||||
"<script src=\"\(path)\"></script>"
|
||||
func scriptInclude(path: String, asModule: Bool) -> String {
|
||||
if asModule {
|
||||
return "<script type=\"module\" src=\"\(path)\"></script>"
|
||||
}
|
||||
return "<script src=\"\(path)\"></script>"
|
||||
}
|
||||
|
||||
func codeHighlightFooter() -> String {
|
||||
|
@ -38,12 +38,11 @@ struct PageHeadGenerator {
|
||||
content[.customPageContent] = results.getContentOfOptionalFile(at: page.additionalHeadContentPath, source: page.path)
|
||||
|
||||
let head = (content[.customPageContent].unwrapped { [$0] } ?? []) + headers
|
||||
.map { $0.rawValue }
|
||||
.sorted()
|
||||
.sorted { $0.rawValue < $1.rawValue }
|
||||
.map { option in
|
||||
let scriptPath = "assets/js/\(option)"
|
||||
let scriptPath = "assets/js/\(option.rawValue)"
|
||||
let relative = page.relativePathToOtherSiteElement(file: scriptPath)
|
||||
return factory.html.scriptInclude(path: relative)
|
||||
return factory.html.scriptInclude(path: relative, asModule: option.asModule)
|
||||
}
|
||||
|
||||
content[.customPageContent] = head.joined(separator: "\n")
|
||||
|
Reference in New Issue
Block a user