szeiger / ornate

A Markdown-based site generator
http://szeiger.github.io/ornate-doc/
Other
80 stars 12 forks source link

Ornate default settings overlap with sbt-site defaults #6

Closed julienrf closed 7 years ago

julienrf commented 7 years ago

Both ornate and sbt-site use target/site, by default. Also, both ornate and sbt-site use src/site, by default.

Also, it would be more convenient if the ornate task returned the output directory.

Here is my code for sbt-site integration:

val ornateTarget = Def.setting(target.value / "ornate")
ornateSourceDir := Some(sourceDirectory.value / "ornate")
ornateTargetDir := Some(ornateTarget.value)
siteSubdirName in ornate := ""
addMappingsToSiteDir(mappings in ornate, siteSubdirName in ornate)
mappings in ornate := {
  val _ = ornate.value
  val output = ornateTarget.value
  output ** AllPassFilter --- output pair relativeTo(output)
}

If ornate was not using the same source and target directory as sbt-site, by default, and if the ornate task was returning the output directory I could have just written the following:

siteSubdirName in ornate := ""
addMappingsToSiteDir(mappings in ornate, siteSubdirName in ornate)
mappings in ornate := {
  val output = ornate.value
  output ** AllPassFilter --- output pair relativeTo(output)
}

Since sbt-site is widely used, I think it would be worth trying to make its integration simpler.