Builders
Common scenarios (such as LibrarySite
and Blog
) are provided, which wrap raw APIs.
For example, here's the entire code for building Subatomic's own website as a single Ammonite script:
subatomic-site.sc
import $ivy.`com.indoorvivants::subatomic-builders:0.0.8+1-bf82d81a-SNAPSHOT`
import subatomic.builders.librarysite._
import subatomic.builders._
@main
def main(args: String*) = Docs.main(args)
object Docs extends LibrarySite.App {
override def extra(site: Site[LibrarySite.Doc]) = {
site
.addCopyOf(SiteRoot / "CNAME", os.pwd / "docs" / "assets" / "CNAME")
}
def config =
LibrarySite(
name = "Subatomic",
contentRoot = os.pwd / "docs" / "pages" / "internals",
assetsRoot = Some(os.pwd / "docs" / "assets"),
copyright = Some("© 2020 Anton Sviridov"),
githubUrl = Some("https://github.com/indoorvivants/subatomic"),
highlightJS = HighlightJS.default.copy(
languages = List("scala"),
theme = "monokai-sublime"
)
)
}
All builders provide some useful CLI flags:
Usage:
subatomic build
subatomic search
static site builder
Options and flags:
--help
Display this help text.
Subcommands:
build
Build the site
search
Test the generated search index
And running the script will provide a detailed overview of the static files being created:
$ amm subatomic-site.sc build --disable-mdoc
Creating site in /tmp/3661131369245107661
search/index.html
^--content--> <html><head><title>Subatomic: Search </title><l...
diagrams/index.html
^--content--> <html><head><title>Subatomic: Diagrams with D2<...
internals/index.html
^--content--> <html><head><title>Subatomic: Internals</title>...
assets/search-index.js
^--copy-of--> /tmp/7014622790361518495.tmp
assets/search.js
^--copy-of--> /tmp/8179321218360049400.tmp
assets/logo.png
^--copy-of--> /home/runner/work/subatomic/subatomic/docs/assets/logo.png
assets/test.html
^--copy-of--> /home/runner/work/subatomic/subatomic/docs/assets/test.html
CNAME
^--copy-of--> /home/runner/work/subatomic/subatomic/docs/assets/CNAME
index.html
^--content--> <html><head><title>Subatomic: Home</title><link...
^--processed-from--> Text(Home,/home/runner/work/subatomic/subatomic/docs/pages/index.md,false,tru...
internals/raw/index.html
^--content--> <html><head><title>Subatomic: Raw API</title><l...
^--processed-from--> Text(Raw API,/home/runner/work/subatomic/subatomic/docs/pages/internals/raw.m...
internals/classpath/index.html
^--content--> <html><head><title>Subatomic: Mdoc and classpat...
^--processed-from--> Text(Mdoc and classpath,/home/runner/work/subatomic/subatomic/docs/pages/inte...
scalajs/index.html
^--content--> <html><head><title>Subatomic: Scala.js support ...
^--processed-from--> Text(Scala.js support ,/home/runner/work/subatomic/subatomic/docs/pages/scala...
builders/index.html
^--content--> <html><head><title>Subatomic: Builders</title><...
^--processed-from--> Text(Builders,/home/runner/work/subatomic/subatomic/docs/pages/builders/index...
assets/tailwind.css
^--content--> /*! tailwindcss v3.3.5 | MIT License | https://...
^--processed-from--> <generated and minified tailwind CSS
assets/d2-diagrams/sample-1.svg
^--content--> <?xml version="1.0" encoding="utf-8"?><svg xmln...
^--processed-from--> <D2 diagrams collected from markdown files>
assets/d2-diagrams/sample-2.svg
^--content--> <?xml version="1.0" encoding="utf-8"?><svg xmln...
^--processed-from--> <D2 diagrams collected from markdown files>