Skip to content

Commit

Permalink
Update dokka-customFormat-example to use up-to-date logo styles (#2608)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnatBeresnev committed Aug 17, 2022
1 parent 19eaf4c commit ad1d480
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
24 changes: 24 additions & 0 deletions examples/gradle/dokka-customFormat-example/README.md
@@ -0,0 +1,24 @@
## Dokka custom format example

This example demonstrates a few things:

1. How to override css styles and add custom images.
2. How to change logo used in the header.
3. How to register a custom `Dokka` task with its own independent configuration.

### Running

`dokkaCustomFormat` task has been created in the buildscript of this example project with a few configuration changes.

In order to see the full effect of these changes, run `dokkaCustomFormat` task from your IDE or execute
the following command:

```bash
./gradlew clean dokkaCustomFormat
```

---

If you run any other `Dokka` task, such as `dokkaHtml`, you'll see vanilla `Dokka` without any alterations.
This is because changes to configuration are applied only within `dokkaCustomFormat` task. This can be useful
if you want to generate multiple versions of documentation with different configuration settings.
3 changes: 3 additions & 0 deletions examples/gradle/dokka-customFormat-example/build.gradle.kts
Expand Up @@ -20,6 +20,9 @@ repositories {
*/
tasks.register<DokkaTask>("dokkaCustomFormat") {
pluginConfiguration<org.jetbrains.dokka.base.DokkaBase, org.jetbrains.dokka.base.DokkaBaseConfiguration> {
// Dokka's stylesheets and assets with conflicting names will be overriden.
// In this particular case, logo-styles.css will be overriden and ktor-logo.png will
// be added as an additional image asset
customStyleSheets = listOf(file("logo-styles.css"))
customAssets = listOf(file("ktor-logo.png"))
}
Expand Down
22 changes: 18 additions & 4 deletions examples/gradle/dokka-customFormat-example/logo-styles.css
@@ -1,6 +1,20 @@
#logo {
/*
* All Margins and sizes are custom for the ktor-logo.png file.
* You may need to modify it and find what works best for your case.
*/
.library-name a {
position: relative;
margin-left: 55px;
}

.library-name a::before {
content: '';
background-image: url('../images/ktor-logo.png');
background-repeat: no-repeat;
background-size: 125px 50px;
padding-top: 12px;
height: 65px;
}
position: absolute;
width: 52px;
height: 50px;
top: -18px;
left: -62px;
}

0 comments on commit ad1d480

Please sign in to comment.