aboutsummaryrefslogtreecommitdiff
path: root/project/Site.scala
diff options
context:
space:
mode:
Diffstat (limited to 'project/Site.scala')
-rw-r--r--project/Site.scala28
1 files changed, 11 insertions, 17 deletions
diff --git a/project/Site.scala b/project/Site.scala
index 6cda22bd..cf34353b 100644
--- a/project/Site.scala
+++ b/project/Site.scala
@@ -1,24 +1,18 @@
import sbt._
import sbt.Keys._
-import com.typesafe.sbt.site.JekyllSupport._
-import com.typesafe.sbt.SbtSite._
object Site {
- val siteSettings = site.settings ++ site.jekyllSupport() ++
- inConfig(Jekyll)(Seq(
- RequiredGems := Map("jekyll" -> "1.3.0", "liquid" -> "2.5.4"),
- mappings <<= (sourceDirectory, target, includeFilter, CheckGems, streams) map {
- (src, t, inc, _, s) => buildJekyll(src, t, inc, s) } ))
+ val serveSite = taskKey[Unit]("Start a embedded web server with access to the site.")
+ val jekyllSource = settingKey[File]("Location of jekyll sources.")
- def buildJekyll(src: File, target: File, inc: FileFilter, s: TaskStreams): Seq[(File, String)] = {
- // Run Jekyll
- sbt.Process(Seq("jekyll", "build", "--destination", target.getAbsolutePath), Some(src)) ! s.log match {
- case 0 => ()
- case n => sys.error("Could not run jekyll, error: " + n)
+ val siteSettings = Seq(
+ jekyllSource := sourceDirectory.value / "main" / "jekyll",
+ serveSite := {
+ val command = "jekyll serve --watch --trace --detach" +
+ " --source " + jekyllSource.value.absolutePath +
+ " --destination " + (target.value / "_site").absolutePath
+
+ sbt.Process(command, jekyllSource.value, ("LC_ALL", "en_US.UTF-8")).run
}
- // Figure out what was generated.
- for {
- (file, name) <- (target ** inc x relativeTo(target))
- } yield file -> name
- }
+ )
} \ No newline at end of file