SplashPublishPlugin icon indicating copy to clipboard operation
SplashPublishPlugin copied to clipboard

Update README.md

Open Ged2323 opened this issue 3 years ago • 2 comments

For some reason -> .installPlugin(.splash(withClassPrefix: "classPrefix")) was not working and colouring the code properly though if you use -> ,plugins: [ .splash(withClassPrefix: "") ] Splash colours work.

Ged2323 avatar Jul 26 '20 23:07 Ged2323

I tried the latter one while it still doesn't work. It seems that the CSS file is neither referenced in the head of html pages nor copied to the generated folder.

uetcis avatar Oct 11 '20 08:10 uetcis

We can reference CSS from HTML by doing the following. ref: https://github.com/uhooi/website-sample/pull/3

extension Theme {
    static var uhooi: Self {
        Theme(
            htmlFactory: UhooiHTMLFactory(),
            resourcePaths: [
                "Resources/UhooiTheme/styles.css",
+               "Resources/SplashPublishPlugin/sundellsColors.css",
            ]
        )
    }
}

private struct UhooiHTMLFactory<Site: Website>: HTMLFactory {
    // ...
    func makeItemHTML(for item: Item<Site>,
                      context: PublishingContext<Site>) throws -> HTML {
        HTML(
            .lang(context.site.language),
-           .head(for: item, on: context.site),
+           .head(for: item, on: context.site, stylesheetPaths: [
+               "/styles.css",
+               "/sundellsColors.css",
+           ]),
        // ...
    }
    // ...
}

uhooi avatar Mar 31 '22 09:03 uhooi