Skip to content

Commit

Permalink
Merge pull request #56 from mkurz/sbt-site
Browse files Browse the repository at this point in the history
Latest sbt-site in scripted test
  • Loading branch information
mkurz authored Feb 13, 2024
2 parents c6970d8 + a16acda commit ac682e9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object ParadoxMaterialThemePlugin extends AutoPlugin {

override lazy val projectSettings: Seq[Setting[_]] = Def.settings(
paradoxMaterialThemeGlobalSettings,
paradoxMaterialThemeSettings(Compile)
paradoxMaterialThemeSettings
)

lazy val paradoxMaterialThemeGlobalSettings: Seq[Setting[_]] = Def.settings(
Expand All @@ -29,20 +29,17 @@ object ParadoxMaterialThemePlugin extends AutoPlugin {
paradoxTheme := Some("com.github.sbt" % "paradox-material-theme" % (paradoxMaterialTheme / version).value)
)

def paradoxMaterialThemeSettings(config: Configuration): Seq[Setting[_]] =
inConfig(config)(
Def.settings(
paradoxMaterialTheme := ParadoxMaterialTheme(),
paradoxProperties += ("material.theme.version" -> (paradoxMaterialTheme / version).value),
paradoxProperties ++= paradoxMaterialTheme.value.paradoxProperties,
paradoxMaterialTheme / mappings := Def.taskDyn {
if (paradoxProperties.value.contains("material.search"))
Def.task(Seq(SearchIndex.mapping(config).value))
else
Def.task(Seq.empty[(File, String)])
}.value,
paradox / mappings ++= (paradoxMaterialTheme / mappings).value
)
)
lazy val paradoxMaterialThemeSettings: Seq[Setting[_]] = Def.settings(
Compile / paradoxMaterialTheme := ParadoxMaterialTheme(),
Compile / paradoxProperties += ("material.theme.version" -> (paradoxMaterialTheme / version).value),
Compile / paradoxProperties ++= (Compile / paradoxMaterialTheme).value.paradoxProperties,
Compile / paradoxMaterialTheme / mappings := Def.taskDyn {
if ((Compile / paradoxProperties).value.contains("material.search"))
Def.task(Seq(SearchIndex.mapping(Compile).value))
else
Def.task(Seq.empty[(File, String)])
}.value,
Compile / paradox / mappings ++= (Compile / paradoxMaterialTheme / mappings).value
)

}
8 changes: 2 additions & 6 deletions plugin/src/sbt-test/sbt-site/can-use-theme/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ name := "test"

enablePlugins(ParadoxSitePlugin, ParadoxMaterialThemePlugin)

//#theme-site-settings
ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(Paradox)
//#theme-site-settings

Paradox / paradoxProperties ++= Map(
Compile / paradoxProperties ++= Map(
"github.base_url" -> "https://github.com/sbt/sbt-paradox-material-theme"
)

Paradox / paradoxMaterialTheme ~= {
Compile / paradoxMaterialTheme ~= {
_.withCopyright("test-copyright")
.withLogo("test-logo")
.withFavicon("test-favicon")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ sys.props.get("project.version") match {
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
}

addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.1")
addSbtPlugin(("com.github.sbt" % "sbt-site-paradox" % "1.5.0").exclude("com.lightbend.paradox", "sbt-paradox"))
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-theme" % "0.9.2")
addSbtPlugin("com.github.sbt" % "sbt-site" % "1.5.0")
addSbtPlugin(("com.github.sbt" % "sbt-site-paradox" % "1.5.0").exclude("com.lightbend.paradox", "sbt-paradox"))
addSbtPlugin("com.github.sbt" % "sbt-ghpages" % "0.8.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
Expand Down
7 changes: 0 additions & 7 deletions src/main/paradox/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ And enable the theme plugin in your project's `build.sbt`:

@@ snip [build.sbt]($root$/plugin/src/sbt-test/paradox/can-use-theme/build.sbt) { #enable-plugin }

If you are generating your site with [sbt-site] you also need to add a few
additional settings in `build.sbt`:

@@ snip [build.sbt]($root$/plugin/src/sbt-test/sbt-site/can-use-theme/build.sbt) { #theme-site-settings }

[sbt-site]: http://www.scala-sbt.org/sbt-site/generators/paradox.html

## Configuring the theme

The theme is configurable via Paradox properties which means that you can
Expand Down

0 comments on commit ac682e9

Please sign in to comment.