Skip to content

Commit 52512d7

Browse files
committed
Add tips and tricks section to README with Gradle icon copying instructions
1 parent b74a3ca commit 52512d7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ needs.
7878
- [Basic conversion](#basic-conversion)
7979
- [Icon pack configuration](#icon-pack-configuration)
8080
- [Icon pack with nested packs configuration](#icon-pack-with-nested-packs-configuration)
81+
- [Tips and tricks](#tips-and-tricks)
8182
- [Other](#other)
8283
- [Export formats](#export-formats)
8384
- [Comparison with other solutions](#comparison-with-other-solutions)
@@ -682,6 +683,31 @@ fun Demo() {
682683
}
683684
```
684685

686+
### Tips and tricks
687+
688+
#### Copy generated icons into source folder instead of build folder
689+
690+
To keep generated icons in your source folder (e.g. for version control), you can create custom Gradle tasks to sync
691+
the generated files after the generation task.
692+
693+
```kotlin
694+
val copyTask = tasks.register<Copy>("copyValkyrieIcons") {
695+
dependsOn(tasks.named("generateValkyrieImageVector"))
696+
697+
from(layout.buildDirectory.dir("generated/sources/valkyrie/commonMain"))
698+
into(layout.projectDirectory.dir("src/commonMain/kotlin"))
699+
}
700+
701+
val cleanTask = tasks.register<Delete>("cleanValkyrieGenerated") {
702+
delete(layout.buildDirectory.dir("generated/sources/valkyrie"))
703+
}
704+
705+
tasks.register("updateValkyrieIcons") {
706+
dependsOn(copyTask)
707+
finalizedBy(cleanTask)
708+
}
709+
```
710+
685711
## Other
686712

687713
### Export formats

0 commit comments

Comments
 (0)