Skip to content

Commit

Permalink
Change "useSilk" convention to change whether or not silk is a depend…
Browse files Browse the repository at this point in the history
…ency
  • Loading branch information
bitspittle committed Jan 7, 2022
1 parent 71db160 commit 52a4baa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ class KobwebxMarkdownPlugin : Plugin<Project> {
val kobwebxBlock = (project.extensions["kobwebx"] as ExtensionAware)

val markdownConfig = kobwebxBlock.extensions.create("markdown", MarkdownConfig::class.java)
(markdownConfig as ExtensionAware).extensions.apply {
create("components", MarkdownComponents::class.java)
create("features", MarkdownFeatures::class.java)
}
val markdownComponents = (markdownConfig as ExtensionAware).extensions.create("components", MarkdownComponents::class.java)
(markdownConfig as ExtensionAware).extensions.create("features", MarkdownFeatures::class.java)

val convertTask = project.tasks.register(
"kobwebxMarkdownConvert",
Expand All @@ -28,6 +26,11 @@ class KobwebxMarkdownPlugin : Plugin<Project> {
)

project.afterEvaluate {
markdownComponents.useSilk.convention(project.configurations.asSequence()
.flatMap { config -> config.dependencies }
.any { dependency -> dependency.name == "kobweb-silk" }
)

project.tasks.named("kobwebGenSite") {
dependsOn(convertTask)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ abstract class MarkdownComponents {
abstract val th: Property<NodeScope.(TableCell) -> String>

init {
useSilk.convention(true)

text.convention { text ->
if (useSilk.get()) {
"$SILK.text.Text(\"${text.literal}\")"
Expand Down

0 comments on commit 52a4baa

Please sign in to comment.