layout | technologies | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
home |
|
sbt-microsites is a sbt plugin tool that facilitates the creation of fancy microsites for your projects.
It's based in other awesome sbt plugins to make it posible, so basically, integrates everything in some basic steps to automatically create and publish the microsite to GitHub Pages.
The plugin provides some basic free styles, css, and image resources by default, everything based Bootstrap framework. If you want to personalize color palette, styles and images you can do it in your project side in a easy way as you can see in the documentation.
In order to achieve the microsite creation, it uses directly these plugins and libraries:
Additionally it depends on other useful libraries and plugins like:
To satisfy the jekyll
prerequisite, here a couple of hints for local and travis environments.
Depending on your platform, you might do this with:
yum install jekyll
apt-get install jekyll
gem install jekyll
If you have enabled Travis for your project, you might have to tweak some parts of your .travis.yml
file:
Potentially, your project is a scala project (language: scala
), therefore you need to add the bundle gems vendro path in the PATH
environment variable:
before_install:
- export PATH=${PATH}:./vendor/bundle
This is needed in order to install and be able to use jekyll
gem from other parts of your project. We have to do it in the Travis install
section:
install:
- ...
- gem install jekyll -v 3.2.1
First of all, add the following lines to the project/plugins.sbt
file, within your project or sbt module where you want to use the sbt-microsites
plugin. Depending on the version:
Latest release:
addSbtPlugin("com.fortysevendeg" % "sbt-microsites" % "0.2.0")
Latest snapshot built from the master
branch code:
println("""resolvers += Resolver.sonatypeRepo("snapshots")""")
println(s"""addSbtPlugin("com.fortysevendeg" % "sbt-microsites" % "${microsites.BuildInfo.version}"""")
Finally, to enable the plugin, add this to your build.sbt
file:
enablePlugins(MicrositesPlugin)
Once you have written down your documents you can build the microsite running this sbt task:
sbt> makeMicrosite
Internally, sequentially it'll run other tasks, among theirs, tut
and makeSite
(sbt-site) tasks.
-
In a shell, navigate to the generated site directory in
target/site
-
Start jekyll with
jekyll serve
-
Navigate to http://localhost:4000/yourbase_url/ in your browser, where
yourbase_url
depends on your own preferences (seemicrositeBaseUrl
setting).
Before publishing, a couple of requirements should be satisfied:
- Initializing the gh-pages branch, you can follow the instructions defined in the sbt-ghpages repository
- Define
micrositeGithubOwner
andmicrositeGithubRepo
settings, you can see more details about them later on in this document
Once both requirements are satisfied, you can just run:
sbt> publishMicrosite
Apart from the microsite for this plugin that you can finde in the docs
sbt module in this repository, a quite complete example is located on https://github.com/47deg/dummy-sbt-microsite.
Please see the documentation for more information.